jquery.ajax apply,jquery ajax 問題請教

jquery ajax 問題請教,請前輩高人幫忙解答

使用jQuery jquery-1.4.2.min.js  官方JS包

平時通過 AJAX  post 到 ashx頁面來訪問後臺  CS是可以正常執行的。

但是今天在使用AJAX的時候,有成功 post到 ashx 頁面,有DEBUG跟蹤到成功context.Response.Write(result);

但是回到頁面上,jquery 報錯錯誤:

行: 1936

錯誤: 未指定的錯誤。

jquery 報錯的代碼:

handle: function( event ) 下面的

var ret = handleObj.handler.apply( this, arguments );

我的前端AJAX代碼:

$.ajax({

type: "post",

async: false,

processData: false,

dataType: "xml",

url: "/ewfv3/web/def/Inc/ashx/UCLCreateButton.ashx?modeType=xml&MothodName=Sign",

contentType: "text/xml",

data: strXml,

error: function(xhr, textStatus, thrownError)

{

alert("Error:" + xhr.responseText);

},

success: function(x)

{

if(x.text==null)

{

alert(x);

retValue= x.documentElement.textContent;

}

else

{

retValue = x.text;

}

}

});

ashx文件代碼:

using System;

using System.Data;

using System.Web;

using System.Collections;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Configuration;

using System.Data.OracleClient;

using System.Text;

using System.Xml;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

public class UCLCreateButton : IHttpHandler

{

public void ProcessRequest(HttpContext context)

{

if (System.Web.HttpContext.Current.Request["modeType"] != null)

{

if (System.Web.HttpContext.Current.Request["modeType"].ToString() == "xml")

{

context.Response.ContentType = "application/xml";

}

}

else

{

context.Response.ContentType = "text/plain";

}

//System.Diagnostics.Debug.Assert(false);

context.Response.Buffer = true;

context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);

context.Response.AddHeader("pragma", "no-cache");

context.Response.AddHeader("cache-control", "");

context.Response.CacheControl = "no-cache";

string result = "", p_MothodName = "";

if (context.Request.Params["MothodName"] != null)

{

p_MothodName = context.Request.Params["MothodName"];

result = Main(p_MothodName, context);

}

else

{

context.Response.Write(result);

return;

}

context.Response.Write(result);

}

private string Main(string p_MothodName, HttpContext context)

{

switch (p_MothodName)

{

case "Sign":

{

return "" + new BusEWF.BusEntry().LoadMethod("Sign", QueryXmlDocu(), context) + "";

}

default:

return "";

}

}

private System.Xml.XmlDocument QueryXmlDocu()

{

System.Xml.XmlDocument xd2 = new System.Xml.XmlDocument();

if (System.Web.HttpContext.Current.Request["modeType"] == "xml")

{

try

{

System.Web.HttpContext.Current.Response.ContentType = "application/xml";

xd2.Load(System.Web.HttpContext.Current.Request.InputStream);

return xd2;

}

catch (Exception ex)

{

System.Web.HttpContext.Current.Response.ContentType = "text/plain";

System.Web.HttpContext.Current.Response.Write(ex.Message);

System.Web.HttpContext.Current.Response.End();

return new System.Xml.XmlDocument();

}

}

else

return new System.Xml.XmlDocument();

}

public bool IsReusable

{

get

{

return false;

}

}

}

備註:我有跟蹤debug,前端傳遞的參數,已經執行後臺方法返回值,都是成功的,不知道錯誤問題在哪,請高手幫忙解答,高分送上

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值