Jquery ajax json response not showing -
hey code follows:
js:
$.ajax({ type: "post", url: "master.php", contenttype: "application/json; charset=utf-8", data: { "called": "reg", "fname": $("#fname").val() }, datatype: "json", success: function(data, responsetext, textstatus){ response = jquery.parsejson(data); console.log("good: " + response); console.log("good3: " + textstatus); console.log("good3: " + responsetext); }, error: function(xmlhttprequest, textstatus, errorthrown){ console.log("error: " + textstatus); } });
and master.php has:
<?php $called = $_post['called']; if ($called == 'reg') { $json = array('good' => 'the value here'); header("content-type: application/json", true); echo json_encode($json); } ?>
the console output this:
good: null form.php:102
good3: [object object] form.php:103
good3: success
what missing?
you're using post method, accessing $_get array in php script
Comments
Post a Comment