这是我的jQuery代码
var ajaxUrl = "AjaxCallHandler.aspx";
function _init_Chart() {
$.ajax({
type: "GET", //GET or POST or PUT or DELETE verb
url: ajaxUrl, // Location of the service
data: "OpCode=GetCallAverageReportForGraph&Parms=DeptId^17~Month^10~Year^2012", //Data sent to server
contentType: "", // content type sent to server
dataType: "string", //Expected data format from server
processdata: true, //True or False
success: function (responseString) {//On Successful service call
alert(responseString);
}
});
return false;
}
这是我的 C# 代码
protected void Page_Load(object sender, EventArgs e)
{
string responseMessage = "";
string status = "SUCCESS";
try
{
if (Request.QueryString["OpCode"] == null)
{
throw new Exception("Invalid Request, OpCode missing.");
}
string operationRequested = Request.QueryString["OpCode"];
string Params = Request.QueryString["Parms"];
switch (operationRequested)
{
case "GetCallAverageReportForGraph":
responseMessage = GetCallAverageReportForGraph(Params);
break;
case "GetCallAverageReportDetails":
responseMessage = GetCallAverageReportDetails(Params);
break;
}
}
catch (Exception exp)
{
status = "EXCEPTION";
responseMessage = exp.Message;
}
Response.ClearContent();
Response.ClearHeaders();
Response.Write(responseMessage);
}
我尝试在 c# 代码中放置一个断点。它是用Response.Write
c# 代码编写的,但我无法接收到 jquery 代码中的响应。任何人都可以指出这个问题吗?