The following update statement, there is a problem, as long as a open this upload page, there is no point to upload button, the update statement is executed, excuse me what reason is this?
$. Ajax ({
Type: "POST",
DataType: "text",
Url: "https://www.baidu.com/ProjectService.asmx/CreateProject",
Data: {" jsonStr ": jsontr},
CrossDomain: true==! (document. All),//ie 10 browser need to add the below!!
Success: the function () {
Alert (" uploaded successfully, please check whether there is upload record!" );
<%
SQL="update [project] set status='uploaded where id=" & amp; Request (" id ")
Conn. Execute (SQL)
% & gt;
},
Error: function () {
Alert (" upload fails, please contact the administrator to confirm!" );
}
});
CodePudding user response:
This is how complex ah. Suggest you see Promise. You can write like this:f1 (). Then (f2);f1, remote update function f2 said local update function
CodePudding user response:
ABC: an introduction to Promise Promise object. If you have a look at the jquery documentation, document has introduced: deferred. Promise ()CodePudding user response:
jsp? With new write in service, call him here methodCodePudding user response:
Default is asynchronous ajax requests, set the ajax async is false, the method of parameter update success function returns success in SQL statementsCodePudding user response:
(f1). Then (f2);
CodePudding user response:
<%SQL="update [project] set status='uploaded where id=" & amp; Request (" id ")
Conn. Execute (SQL)
% & gt;
This code is Java code, even though you are on the success, but a into the JSP page, it is the immediate execution of a painting, you should be performed after the success, then call an ajax method, in this method, the ajax request url, to carry out your this piece of Java code, the url may be a servlet or JSP
CodePudding user response:
Add an ajax request inside success, then write code executing SQL statements