Form is resubmitting when I refresh the page ajax

I have a call so that when submitting the form, it does not refresh. Right now one value is making my form resubmit when f5 is pressed of when I manually click enter on the address bad.

My plugin value taken from options page and wp_options

Read More
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 />";
}   

My variable call. If I don’t check for $wb_twitter_live_feed_options[‘twitter_mention_tag’], it doesn’t resubmit on refresh (f5 or manually clicking enter)

if($wb_twitter_live_feed_options['twitter_mention_tag']){   
  $twitter_mention_tag = "#test";
}

My ajax call

$('#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
            }
        });
    });

Related posts

Leave a Reply