I am developing server side code for Ajax which receives a JSON object from client. But the JSON object which I receive on the server contains contains \ for no reason whatsoever. e.g:
I am receiving
{\"coords\":[{\"id\":\"M0DyTx0\",\"xy\":[20,120]}]}
instead of
{"coords":[{"id":"M0DyTx0","xy":[0,100]}]}
The related code, server side code is :
Code: Select all
fwrite($fp, $_POST['data']);Code: Select all
var req = new XMLHttpRequest();
req.open( POST, "http://" + window.location.host + ":82/test.php", true );
req.send('data=' + encodeURIComponent(JSON.stringify(this.changes)));