Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 当我刷新页面时,表单正在重新提交_Php_Jquery_Ajax_Wordpress - Fatal编程技术网

Php 当我刷新页面时,表单正在重新提交

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

我有一个电话,所以在提交表单时,它不会刷新。现在,一个值是当按下f5时,使我的表单重新提交;或者当我手动单击地址上的enter时,使我的表单重新提交

我的插件值取自选项页和wp_选项

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
            }
        });
    });