我在我的asp文件中使用以下jquery函数
$(function() {
$("#frm-submit").submit(function() {
var data = $(this).serialize(),
action = $(this).attr("action"),
method = $(this).attr("method");
//Hide Login Button
//$('#loginprogress').html('<img src="images/loading_bar.gif">'); // Show Progress Spinner
//$(".loading").show(); // show loading div
$.ajax({
url: action,
type: method,
data: data,
success: function(data) {
$("#stage").text(data);
document.location = "***awp.asp***"; // Hide Progress Spinner
},
error: function(err) {
// there was something not right...
},
complete: function() {
$(".loading").hide(); // hide the loading
}
});
return false; // don't let the form be submitted
});
}
);
我的awp.asp文件是
objdb.execute("insert into awp values('"& awpid &"','"& varcid &"','"& varsid &"','"& varmcid &"','"& varsubacid &"','"& varselaid &"','"& varselsubaid &"','"& vardivid &"','-','"& varunits &"','"& varucost &"','"& varptarget &"','"& varftarget &"','"& varbbenefper &"','"& varida &"','"& vargovtcot &"','"& varbcont &"','"& now() &"','"& loginid &"','"& varawp &"','"& seldish("catid")&"','"& seldish("minorheadcode")&"')")
我必须返回成功或错误消息
目前我将其存储为会话可用 session(“message”)=“成功插入记录”
如何显示成功消息?
答案 0 :(得分:0)
在您的ASP中,您需要处理execute
电话的成功/失败,然后只需回复相关内容......
Response.Write("Database updated");
Response.End();
将data
传递给您在ajax调用中成功回调的内容...
success: function(data) {
alert(data); // this will show the ASP response
// do whatever you need when successful
},