...

View Full Version : Problems with Quotes (again)



snoodle
05-05-2009, 07:23 PM
Quotes are haunting me again...


function post_something()
{
var obj = new Object();
obj.item = "test";
$.post('receiver.php', {data: $.toJSON(obj)}, done_func);
}

function done_func(res)
{
alert(res);
}
receiver.php...


echo $_REQUEST['data'];
return;


On my local server the alert shows... {"item ": "test"}
On my host's server the alert shows... {\"item \": \"test\"}

Feeding the 2nd value to var obj = $.evalJSON(res); doesn't work (unless, of course, I remove the slashes).

In php.ini (locally, and remote)...
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

An explanation of what's going on would be very, very much appreciated.

snoodle
05-05-2009, 09:52 PM
I guess stripcslashes() works fine and good to have in there, anyway... I guess.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum