Php 当我刷新页面时,表单正在重新提交
我有一个电话,所以在提交表单时,它不会刷新。现在,一个值是当按下f5时,使我的表单重新提交;或者当我手动单击地址上的enter时,使我的表单重新提交 我的插件值取自选项页和wp_选项Php 当我刷新页面时,表单正在重新提交,php,jquery,ajax,wordpress,Php,Jquery,Ajax,Wordpress,我有一个电话,所以在提交表单时,它不会刷新。现在,一个值是当按下f5时,使我的表单重新提交;或者当我手动单击地址上的enter时,使我的表单重新提交 我的插件值取自选项页和wp_选项 function wb_twitter_mention_tag_callback(){ global $wb_twitter_live_feed_options; echo "<input name='wb_twitter_live_feed_options[twitter_ment
function wb_twitter_mention_tag_callback(){
global $wb_twitter_live_feed_options;
echo "<input name='wb_twitter_live_feed_options[twitter_mention_tag]' type='text' value='{$wb_twitter_live_feed_options['twitter_mention_tag']}' /><br />";
}
我的ajax调用
$('#twitterformpost').unbind('submit').bind('submit', function (e) {
$('input[type=submit]', this).attr('disabled', 'disabled');
e.preventDefault();
form = this;
$.ajax({
type: 'post',
url: '',
data: $('#twitterformpost').serialize(),
success: function () {
// Performs twitter post
}
});
});
这是默认行为,因为即使您成功提交表单数据,分配给方法GET或POST的变量仍将保留在同一页面上。在表单提交后取消设置发布/获取数据。好的,我在输入的id中添加了一个取消设置。但是我现在注意到,即使我加载了一个新页面,它仍然会执行一个发布(发布预设['twitter\u title\u tag']重置(清除)ajax回调后表单中的文本输入已成功处理,如果您仅在post数据为!=未定义和!=null和!=空时提供ajax,则更好。这就是问题所在,输入为空,但即使在新页面加载时(在另一个浏览器上),页面加载后也会立即发布
twitter\u-ention\u标记
$('#twitterformpost').unbind('submit').bind('submit', function (e) {
$('input[type=submit]', this).attr('disabled', 'disabled');
e.preventDefault();
form = this;
$.ajax({
type: 'post',
url: '',
data: $('#twitterformpost').serialize(),
success: function () {
// Performs twitter post
}
});
});