Contact form posts to new page, aJax not working

  • Posted in : impressivCard WP
  • jello203
    Participant

    Hi, thanks for the theme -it’s great.

    While setting it up I’ve encountered a problem. The contact form gets sent to the send-mail.php page rather than displaying success notification on the same page as it’s supposed to.

    The page is at http://www.jerelk.com/#/contact.

    Thanks,
    Jerel

    jello203
    Participant

    Well I’m not sure why it wasn’t working but I had to change the $.post line in js/send-mail.js to the following and this was the only way I could get it to work:

    $.ajax({
    data: formValues,
    type: $(this).attr(‘method’),
    url: $(this).attr(‘action’),
    beforeSend:function(){
    //dummy info – don’t know why it won’t work without some code here
    var x=0;
    },
    error: function() {
    alert(“there was an error”);
    },
    success: function(data) {
    if ( data == ‘success’ )
    {
    contactForm.find(‘.submit-area’).removeClass(‘loading’).addClass(“success”);
    contactForm.clearForm();
    }
    else
    {
    contactForm.clearForm();
    alert( ‘The sum is incorrect.’ );
    }
    },
    complete: function() {
    contactForm.clearForm();
    }
    });

    ahmetsali
    Keymaster

    Hi, thanks for sharing your solution.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘impressivCard WP’ is closed to new topics and replies.