0

我在这里需要一个代码示例:/我正在尝试让 jsonp 调用正常工作。

这是我在 jquery 上的代码:

            $.ajax({
                crossDomain:true,
                url: "the_server_url",
                type: "POST",

                data: {
                    numberOfUnits:10,
                    unitType:"u",
                    language:"eng-us",
                    genderAndAge:"MiddleAgeAnyGender",
                    script:"",
                    synced_recording:0,
                    secret:0,
                    numAuditions:0
                },
                dataType: "jsonp",
                success: function(text) {
                    alert("Text: "+text);
                },
                error: function(request,error)
                {
                    alert("err: "+error);
                    alert ( " Can't do because: " + JSON.stringify(request));
                    alert("response text: "+request.responseText);
                }
            });

这就是我得到的:

alert #1: err: parsererror
alert #2: Can't do because: {"readyState":4,"status":200,"statusText":"success"}
alert #3: response text: undefined

我无权访问服务器代码。有任何想法吗?谢谢!

4

0 回答 0