这是成功和错误回调的签名
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);
}
}
}