我正在尝试使用jquery ajax请求从另一台机器的控制器获取数据:
var url = 'http://192.168.1.206/publish' + '/Home/GetStudentById/';
var datas = 'studentId=' + 13;
$.ajax({
type: 'POST',
url: url,
async: false,
data: datas,
crossDomain: false,
jsonpCallback: 'jsonCallback',
contentType: "application/json",
dataType: 'jsonp',
error: function (data) {
alert('bad');
},
success: function (data) {
alert('good');
},
complete: function (data) {
debugger;
alert('foo');
}
});
它返回数据,但总是给我这个错误 Syntax Error: invalid label
和json结果如下:
{"Student0":{"StudentID":"13","RegisterationNo":"125426","FullName":"mohamed bader mohamed bader","ClassName":"First Primary","ClassroomName":"1/5","Phone":"11212","CivilID":"153641789","CurrentClassID":"4","CurrentYearID":"1"},"Student1":{"StudentID":"13","RegisterationNo":"125426","FullName":"mohamed bader mohamed bader","ClassName":"First Primary","ClassroomName":"1/2","Phone":"11212","CivilID":"153641789","CurrentClassID":"4","CurrentYearID":""},"Student2":{"StudentID":"13","RegisterationNo":"125426","FullName":"mohamed bader mohamed bader","ClassName":"First Primary","ClassroomName":"1/3","Phone":"11212","CivilID":"153641789","CurrentClassID":"4","CurrentYearID":""},"Student3":{"StudentID":"13","RegisterationNo":"125426","FullName":"mohamed bader mohamed bader","ClassName":"First Primary","ClassroomName":"1/4","Phone":"11212","CivilID":"153641789","CurrentClassID":"4","CurrentYearID":""},"Student4":{"StudentID":"13","RegisterationNo":"125426","FullName":"mohamed bader mohamed bader","ClassName":"First Primary","ClassroomName":"1","Phone":"11212","CivilID":"153641789","CurrentClassID":"4","CurrentYearID":""}}