jsonp回调错误。内部服务器错误

时间:2012-07-24 14:32:03

标签: web-services jquery-mobile cordova jsonp asmx

我正在尝试访问ajax(jquery-mobile和PhoneGap)到Web服务(asmx),但是有些东西是错的,什么不是。 这是js代码:

$.ajax({
    type        : "POST",
    url         : webMethod,
    data        : param,
    dataType    : 'jsonp',
    jsonp       : 'callback',
    jsonpCallback   : 'jsonpCallback',
    success     : function(data) {  
                   alert(data.nombre);  
                  },
    error       : function(x,y,z) {
                   alert("-- " + x+'\n'+y+'\n'+z + " --");
              }
    });

    function jsonpCallback(){
        alert("OK");
    }

和网络服务(asmx)

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void WebServiceTest()
{
  HttpContext.Current.Response.ContentType = "application/json";
  string qs = HttpContext.Current.Request.QueryString["jsonpCallback"];
  HttpContext.Current.Response.Write(qs + "( [{ \"name\": \"John\", \"message\": \"Ok\"}] )");
}

当我运行调试时给我一个错误 - >

callback = jsonpCallback& _ = 1343139529496 500(内部服务器错误)

我已经尝试了一千件事(或者至少那是我的感觉......)

我非常感谢你的建议。

P上。 S.原谅我可怜的英语

0 个答案:

没有答案