JS代码
function changedata(value) {
$.ajax({
type: "POST",
url: "/IndirectMaterial/DataBind.ashx?plant="+value,
beforeSend: function () {
},
error: function () {
},
success: function (data) {
alert(data);
}
})//ajax end
}
ashx中的代码
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
if (context.Request.Form["plant"].ToString() != "")
{
data = context.Request.Form["plant"].ToString().Trim();
}
context.Response.Write(GetData(data)); //调用自定义函数
}
问题是现在进不去红色标注的方法中,该有的jquery引用都已经有了,路径也是正确的(系统生成的)。求教高手。。
function changedata(value) {
$.ajax({
type: "POST",
url: "/IndirectMaterial/DataBind.ashx?plant="+value,
beforeSend: function () {
},
error: function () {
},
success: function (data) {
alert(data);
}
})//ajax end
}
ashx中的代码
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
if (context.Request.Form["plant"].ToString() != "")
{
data = context.Request.Form["plant"].ToString().Trim();
}
context.Response.Write(GetData(data)); //调用自定义函数
}
问题是现在进不去红色标注的方法中,该有的jquery引用都已经有了,路径也是正确的(系统生成的)。求教高手。。
function changedata(value) {
$.ajax({
type: "POST",
url: "../IndirectMaterial/DataBind.ashx?plant="+value,
beforeSend: function () {
},
error: function () {
},
success: function (data) {
alert(data);
}
})//ajax end
}
[code=javascript]init:function(){
$.ajax({
type:"POST",
url:"getwebpage.do",
cache:false,
async: false,
dataType:"html",
data:{"pagename":"first"},
beforeSend: function(XMLHttpRequest){
},
success: function(data, textStatus){
$("#workBodyId").html(data);
},
complete: function(XMLHttpRequest, textStatus){
},
error: function(XMLHttpRequest, textStatus, errorThrown){
ERROR.show("LoginAccountManager Exception Connect Administrator");
}
});
return this;
},[/code]
请您先断点跟踪到:
ashx中的代码
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
就"Hello World"这一行。 如果都没有进来, 那就什么都没得说了。
先在这行下面end。一步一步调试。你的js代码部分。木有问题。别被楼上的某人给迷糊了。