Search code examples
jqueryajaxformspluginsajaxform

How do I submit a form using jquery (ajaxForm plugin) to an external site but not reload to a different page?


I'm trying to create a form that sends the customer's name and email address to icontact (an email list application).

All the values are correct for icontact and if I submit the form as usual, icontact responds that it added the email address. The success message loads in a new page from icontact's website.

What I'd like to accomplish is that ajax would send the form and returns a success message within the current page, without sending the customer to a new page.

Here is the test page: http://www.skhot.com/test/js-test/forms/index.php


Solution

  • For those who are having trouble submitting the icontact form via ajax try this:

    $.get("https://app.sandbox.icontact.com/icp/signup.php", { listid: "xxx", "specialid:xxx": "xxx",clientid : "xxx",fields_email: 'test@gmail.com' }, function(){
    
                        alert('email added to the list :)');
    
                } );
    

    replace xxx with the required parameter :)