Form submission canceled because the form is not connected

This commit is contained in:
lealife
2017-04-12 15:58:55 +08:00
parent 6af19670da
commit 4ffd048b2a
3 changed files with 21 additions and 12 deletions

View File

@ -63,10 +63,13 @@ function search(e) {
if(!keywords) {
location.href = "{{$.searchUrl}}";
} else {
var tpl = '<form action="{{$.searchUrl}}" method="get">';
var tpl = '<form style="display: none" action="{{$.searchUrl}}" method="get">';
tpl += '<input name="keywords" value="' + keywords + '" />';
tpl += "</form";
$(tpl).submit();
var $tpl = $(tpl);
$('body').append($tpl)
$tpl.submit();
$tpl.remove();
}
}
</script>

View File

@ -63,10 +63,13 @@ function search(e) {
if(!keywords) {
location.href = "{{$.searchUrl}}";
} else {
var tpl = '<form action="{{$.searchUrl}}" method="get">';
var tpl = '<form style="display: none" action="{{$.searchUrl}}" method="get">';
tpl += '<input name="keywords" value="' + keywords + '" />';
tpl += "</form";
$(tpl).submit();
var $tpl = $(tpl);
$('body').append($tpl)
$tpl.submit();
$tpl.remove();
}
}
</script>

View File

@ -63,10 +63,13 @@ function search(e) {
if(!keywords) {
location.href = "{{$.searchUrl}}";
} else {
var tpl = '<form action="{{$.searchUrl}}" method="get">';
var tpl = '<form style="display: none" action="{{$.searchUrl}}" method="get">';
tpl += '<input name="keywords" value="' + keywords + '" />';
tpl += "</form";
$(tpl).submit();
var $tpl = $(tpl);
$('body').append($tpl)
$tpl.submit();
$tpl.remove();
}
}
</script>