I have implemented an Ajax request on my website, and I am calling the endpoint from a webpage. (我已经在我的网站上实现了Ajax请求,并且正在从网页调用端点。) It always returns 200 OK , but jQuery executes the error event. (它总是返回200 OK ,但是jQuery执行error事件。) I tried a lot of things, but I could not figure out the problem. (我尝试了很多事情,但无法弄清问题所在。) I am adding my code below: (我在下面添加我的代码:)
jQuery Code (jQuery代码)
var row = "1";
var json = "{'TwitterId':'" + row + "'}";
$.ajax({
type: 'POST',
url: 'Jqueryoperation.aspx?Operation=DeleteRow',
contentType: 'application/json; charset=utf-8',
data: json,
dataType: 'json',
cache: false,
success: AjaxSucceeded,
error: AjaxFailed
});
function AjaxSucceeded(result) {
alert("hello");
alert(result.d);
}
function AjaxFailed(result) {
alert("hello1");
alert(result.status + ' ' + result.statusText);
}
C# code for JqueryOpeartion.aspx
(JqueryOpeartion.aspx
C#代码)
protected void Page_Load(object sender, EventArgs e) {
test();
}
private void test() {
Response.Write("<script language='javascript'>alert('Record Deleted');</script>");
}
I need the ("Record deleted")
string after successful deletion. (成功删除后,我需要("Record deleted")
字符串。) I am able to delete the content, but I am not getting this message. (我可以删除内容,但是没有收到此消息。) Is this correct or am I doing anything wrong? (这是正确的还是我做错了什么?) What is the correct way to solve this issue? (解决此问题的正确方法是什么?)
ask by Pankaj Mishra translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…