I am having trouble sending JSON data to a server.
Its definitely reaching the parser.php, but I am not what to create in PHP to fetch this data. Also I am not sure my Javascript is correct.
<SCRIPT>
var JSONObject = new Object;
JSONObject.description = “hello”;
JSONstring = JSON.stringify(JSONObject);
runAjax(JSONstring);
var request;
function runAjax(JSONstring)
{
// function returns “AJAX” object, depending on web browser
// this is not native JS function!
var request;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
request=new XMLHttpRequest();
}
else
{// code for IE6, IE5
request=new ActiveXObject(“Microsoft.XMLHTTP”);
}
request.open(“POST”, “
request.setRequestHeader(“Content-type”,”application/x-www-form-urlencoded”);
request.send(JSONstring);
}
</SCRIPT>