Stop AJAX request before submitting entry

This commit is contained in:
2015-06-05 15:59:51 +02:00
parent fc8b35d9fb
commit c7d1f53594
3 changed files with 11 additions and 2 deletions
+4
View File
@@ -36,6 +36,9 @@ function asend() {
var r = XMLHttpRequestGeneric();
r.onreadystatechange = function()
{
if (r.readyState==4)
in_asend = false;
// after successful completion ...
if (r.readyState==4 && r.status==200) {
// restore original title
@@ -85,6 +88,7 @@ function asend() {
// add jcmd
f.append("jcmd", "Save");
in_asend = true;
r.send(f);
}
+5
View File
@@ -9993,6 +9993,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("var entry_modified = false;\n");
rsprintf("var draft_modified = false;\n");
rsprintf("var last_key = 0;\n\n");
rsprintf("var in_asend = false;\n\n");
rsprintf("function chkform()\n");
rsprintf("{\n");
@@ -10155,6 +10156,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
}
}
rsprintf(" if (autoSaveTimer != null)\n");
rsprintf(" clearTimeout(autoSaveTimer);\n");
rsprintf(" while (in_asend);\n"); // wait for any running asynchronous operation
rsprintf(" submitted = true;\n");
rsprintf(" return true;\n");
rsprintf("}\n\n");
@@ -10164,6 +10168,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("{\n");
rsprintf(" if (autoSaveTimer != null)\n");
rsprintf(" clearTimeout(autoSaveTimer);\n");
rsprintf(" while (in_asend);\n"); // wait for any running asynchronous operation
rsprintf(" submitted = true;\n"); // don't ask to leave that page
rsprintf(" return true;\n");
rsprintf("}\n\n");
@@ -7,7 +7,7 @@
<key>IDESourceControlProjectIdentifier</key>
<string>81431534-03C4-4F18-8910-AA341A0BBED2</string>
<key>IDESourceControlProjectName</key>
<string>project</string>
<string>elogd</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>4A8AA611133AD3F7E07C7C33DCF50244FB7A1AB5</key>
@@ -16,7 +16,7 @@
<string>bitbucket.org:ritt/elog.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>xcode/elogd.xcodeproj/project.xcworkspace</string>
<string>xcode/elogd.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>4A8AA611133AD3F7E07C7C33DCF50244FB7A1AB5</key>