Last active
March 28, 2017 05:32
-
-
Save kenmori/0fabfa855ac496badbc1ee8c9a5e9bb2 to your computer and use it in GitHub Desktop.
【Android/ (Chrome/56.0.2924.87)】how to fix 「Form submission canceled because the form is not connected」
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//An error occurs //The form will be canceled. On Android/Chrome/56.0.2924.87 | |
$("<form />", { action: "/hoge/fuga", method: "post" }) | |
.append($("<input />", { type: "hidden", name: "xtoken", value: xtoken })) | |
.append($("<input />", { type: "hidden", name: "state", value: "/hoge/" + hogeId })) | |
.append($("<input />", { type: "hidden", name: "hoge", value: hoge })) | |
.append($("<input />", { type: "hidden", name: "back", value: location.pathname })) | |
.submit(); | |
///// | |
//// add .appendTo(document.body), before .submit() | |
//// | |
/// fix | |
$("<form />", { action: "/hoge/fuga", method: "post" }) | |
.append($("<input />", { type: "hidden", name: "xtoken", value: xtoken })) | |
.append($("<input />", { type: "hidden", name: "state", value: "/hoge/" + hogeId })) | |
.append($("<input />", { type: "hidden", name: "hoge", value: hoge })) | |
.append($("<input />", { type: "hidden", name: "back", value: location.pathname })) | |
.appendTo(document.body).submit(); | |
//if not using jQuery, using JS, | |
//after appendChild(form) value, finaly, | |
document.body.appendChild(form); | |
form.submit(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks <3