I've been stuck on this for days now...the problem is this: I want to get multiple values from a PHP file through jQuery Ajax Json. but as soon as i add the dataType: 'json',
to it, that's the end of things. I am using the given code:
PHP - check.php
$oid=1;
$f=10;
echo json_encode(array("oid" => $oid, "cid" => $f));
PS: THE ABOVE CODE IS INSIDE A LOOP THAT RETURNS MANY oid's AND cid's AT ONE TIME!
I've not included the part above or below the script cause it can compromise the security of my site.. :P but this in a nutshell is what the script does.
and here goes the javascript:
jQuery - scripts.js
$.ajax({
type: "POST",
dataType: 'json',
url: "check.php",
data: {anu:"bhav"}
}).done(function( result ) {
if(result!='0'){
var res=result.oid[0];
alert(res);
}
});