Handling an Ajax form submit

You should remove the link from the anchor tag:

<a  class="button" href="#" style="background-color:white;color:black;"> 
  <strong>Submit</strong>
</a>

Then your jQuery part should be:

$('a.button').click(function(event){
    event.preventDefault();

    //your ajax gets here:
    jQuery.ajax({
            type:"post",
            dataType:"json",
            url: ajaxurl,
            data: {action: 'submit_data', info: info},
            success: function(response) {
                alert("Success");
            }
        });
});

Leave a Comment