我使用以下代码提交操作表单:
var actionForm = $('<form>', {'action': 'index.php', 'method': 'post'}).append($('<input>', {'name': 'action', 'value': 'cancel', 'type': 'hidden'})).append($('<input>', {'name': 'id', 'value': '123', 'type': 'hidden'}));
actionForm.submit();
但是,此代码适用于 Chrome、Firefox、Safari、IE,但不适用于 IE10+。怎么会?
使用 jQuery 1.11。
最佳答案
尝试将表单附加到正文并提交
var actionForm = $('<form>', {'action': 'index.php', 'method': 'post'}).append($('<input>', {'name': 'action', 'value': 'cancel', 'type': 'hidden'})).append($('<input>', {'name': 'id', 'value': '123', 'type': 'hidden'}));
actionForm.appendTo('body').submit();
关于javascript - jQuery 表单提交仅在 IE10+ 上不响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30634496/