2011-10-19 11 views
0

JQueryの.ajax関数のsuccess:メソッドでエラーが発生します。JQuery AJAXコールバックでエラーが発生する

MyService.asmx:

[WebMethod] 
     public FileInfo[] GetFileInfo(int Id) 
     { 
      Proxies.ServiceRef.ServiceClient c = new Proxies.ServiceRef.ServiceClient(); 
      return c.GetFileInfo(Id).ToArray(); 
     } 

私はエラーを取得していますjqueryのコード:

  $.ajax({ 
       url: url, 
       data: jsonData, 
       type: "POST", 
       contentType: _I.contentType, 
       timeout: _I.timeout, 
       dataType: "serviceproxy", // custom type to avoid double parse 
       dataFilter: function (jsonString, type) { 
        if (type == "serviceproxy") { 
         // Use json library so we can fix up dates   
         var res = JSON.parseWithDate(jsonString); 
         if (res && res.hasOwnProperty("d")) 
          res = res.d; 
         return res; 
        } 
        return jsonString; 
       }, 
       ***success: function (result) { 
        if (callback) 
         callback(result);*** 
       } 
        error: function(xhr, error)....... 

});

私がFirebugを使用してデバッグするときの応答は次のとおりです。私が気づいたのは、エラーコールバックが毎回発生するということです。誰が何が間違っているのか説明できますか?

{"d":[{"__type":"Proxies.AFARServiceRef.AssignmentInfo","ExtensionData":{},"AssignDate":"\/Date(1317748587667)\/","AssignFileName":null,"ClaimId":"PA026195","ClaimantName":"Rachel Weiss","FirstContactDate":"\/Date(1302678000000)\/","FirstContactTime":{"Ticks":433800000000,"Days":0,"Hours":12,"Milliseconds":0,"Minutes":3,"Seconds":0,"TotalDays":0.50208333333333333,"TotalHours":12.049999999999999,"TotalMilliseconds":43380000,"TotalMinutes":723,"TotalSeconds":43380},"Id":5257,"InspectionDate":"\/Date(1302246000000)\/","StatusId":1,"SubmittedCount":5,"UploadedCount":9}]} 

おかげ

BB

答えて

1

あなたの成功コールバックでif機能と成功コールバックの後にカンマため{}ブラケットを行方不明。

success: function (result) { 
    if (callback){ 
    callback(result); 
    } 
}, 
error: function(xhr, error) 
関連する問題