I used jQuery.load function to generate some dynamic page. I used POST method to send some data. The problem is, in my local PC (windows with Apache/php server) everything works fine, but when I upload it to my hosting server in internet (linux with Apache/php), it automatically add slashes to my string. Is jQuery have different behavior in different OS?
$("#fetch").click(function(){
klist ="'a','b','c'";
nlist ="'x','y','z'";
$("#mydiv").load("tor.php", {n: nlist, k: klist},function(){
$("#div2").hide();
});
Output of $_POST[‘n’] in tor.php is:
Local server: “‘x’,’y’,’z'”
Internet Hosting server: “\’x\’,\’y\’,\’z\'”
Same for other variable.
Why it is happening and how to avoid this?
Rather than get into a whole thing about how you should install Linux on your local computer, the problem is that the remote server has the ini setting
magic_quotes_gpcenabled. Either disable this setting or just callstripslasheson all of the$_POSTvalues.