1

我正在尝试使用 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":""}}
4

0 回答 0