1

I am using following ajax to receive data from server.

$.get("http://***/umbraco/Api/SomeApi/SignIn",{apiVersion : 1,email:"name@gmail.com", password:"mypassword" },function(data) {
   alert('in');
   alert(data);
}, "jsonp");

I could see 200 Ok in inspect element. And i could also see the response text. But i couldn't get data in alert. Both above alerts aren't working.

EDIT

I tried the following ajax:

 jQuery.ajax({  
    type: "GET",  
    url: 'http://***/umbraco/Api/SomeApi/SignIn?apiVersion=1&email=name@gmail.com&password=mypassword&callback=?',  
    dataType: "json",  
    success: function (results) {  
        alert("Success!");  
    },  
    error: function (XMLHttpRequest, textStatus, errorThrown) {  
        alert("error");  
        alert('XMLHttpRequest '+ XMLHttpRequest);
        alert('textStatus '+ textStatus);
        alert('errorThrown '+ errorThrown);
    }  
});  

Results in:

 Status Code: 200 Ok

But,

Parse Error is throwing. How can i fix this?

enter image description here enter image description here

Please Help.

4

1 回答 1

0

对于使用 jsonp 调用的服务,该服务必须返回 jsonp,它实际上是一个 javascript 代码。

如果是第三方服务,请确保该服务支持 jsonp。

于 2013-10-29T10:38:54.950 回答