I recently had to reformat and reinstall everything from scratch. Now, the site I am building works fine on my provider's servers, but has a problem on my machine.
I am using JQuery/Javascript & PHP. It appears that upon returning from the server side PHP code, the data returned (echo'ed) is the complete contents of the php file (not the json data i'm passing out). This is happening for all ajax calls. I'm thinking this must be something in the the php.ini file, but don't know what.
A typical ajax caller and handler in my code looks like...
Code:
function jsFunction(){
obj.item1 = "item1_input";
obj.item2 = "item2_input";
var dataString = $.toJSON(obj);
alert("Before Update..... "+dataString);
$.post(handler.php', {data: dataString}, done_function);
}
function done_function(res){
alert(res);
}
Using this simple php code...
PHP Code:
<?php
//
$res = json_decode($_REQUEST["data"], true);
// ...
// ... Processing and modifying contents of "data"
// ...
echo json_encode($res);
return 1;
?>
The value returned to the done_function (res) is the actual contents (code) of the php file, not the data that was echo'ed. Is this due to a setting in php.ini? This code worked fine before the crash and works fine on my provider's server.