$.ajax({
type: "GET",
dataType: "jsonp",
jsonpCallback: "jsoncallback",
//async: false ,
data:
{
// some data here
},
url: "http://mydomain.com/checkRequest.php",
success: function(data){
alert("123");
alert(data.data.NameA);
},
error: function(jqXHR, textStatus){
alert("Request failed: " + textStatus);
}
});// end of ajax
I can get the following string from the URL below,
([{
"data": {
"Rate": "",
"RoleA": "Student",
"NameA": "studentD",
"RoleB": "Tutor",
"NameB": "tutorB",
"Give": "0",
"Get": "1",
"Accept": "0",
"RateCounter": ""
}
}
]);
http://mydomain.com/checkRequest.php?callback=jsoncallback&nameB=tutorB&roleB=Tutor&get=1&roleA=Student&nameA=studentD&give=0&_=1364082750444
however, it alerts parsererror. May I ask where's going wrong?
If I delete jsonpCallback: "jsoncallback", and change URL to url: "http://mydomain.com/checkRequest.php?jsoncallback=?", there is no parsererror, but it does not able to alert(data.data.NameA);