2013-01-10 80 views

回答

0

下面是成功和錯誤回調簽名

private void jsSuccessCallBack(object data, string textStatus, jQueryXmlHttpRequest request) 
     { 

      var items = data as List<FamilyTrustBE>; 
      foreach (FamilyTrustBE item in items) 
      { 
       Helper.Log(string.Format("Result is: id {0}, {1}: {2}", item.id, item.name, item.description)); 
      } 

     } 

     private void jsErrorCallBack(jQueryXmlHttpRequest request, string textStatus, Exception error) 
     { 
      dynamic myerr = error; 
      Helper.Log(string.Format("status={0} in ERROR callback. Error: {1}, Inner: {2}", textStatus, myerr.message, myerr.InnerException)); 
     } 

這裏是我的Helper.Log方法:

[IgnoreNamespace] 
internal class Helper 
{ 
    public static void Log(string str) 
    { 
     var content = jQuery.Select(Helper.HTMLMessageDivSelector).GetHtml(); 
     var messageDiv = jQuery.Select(Helper.HTMLMessageDivSelector); 
     messageDiv.Html(str + "<br/>" + content); 

     //write message to debug console if it is defined 
     dynamic w = System.Html.Window.Self; 
     { 
       if (w.console is object) 
        w.console.log(str); 
     } 

    } 
} 
相關問題