I have an external form, and I want to submit the external form's data to an Eloqua form using an AJAX asynchronous action. I've been trying to find answers to this on the web with no luck. I have successfully obtained the GUID. The form works fine when I use a regular Submit button, connecting to Eloqua successfully. However, as soon as I attach an .ajax function to the Submit button (which tries to submit the data asynchronously and also cancels the button's regular action), that function does not succeed. My .ajax function looks like this:
$("#submitButton").click(function() {
var dataString = 'elqSiteID=' + elqSiteID + '&elqFormName=' + elqFormName + '&FirstName=' + FirstName + '&LastName=' + LastName + '&Email=' + Email + '&retURL=' + retURL + '&elqCustomerGUID=' + elqCustomerGUID + '&elqCookieWrite=' + elqCookieWrite;
$.ajax({
type: "POST",
url: "http://now.eloqua.com/e/f2.aspx",
data: dataString,
success: function() {
$('#responseMessage').html("<h2>Contact Form Submitted!</h2>");
}
});
return false;
});
(In the actual JavaScript, the variable datastring contains more name=value pairs than I've shown here. These are the operative ones.)
I should add that, when this function points toward a do-nothing PHP page instead of http://now.eloqua.com/e/f2.aspx, the .ajax function succeeds, inserting the "Contact Form Submitted!" text into the external form's page. But when I then try to tell that PHP page to submit the data to http://now.eloqua.com/e/f2.aspx, the .ajax function does not succeed.
So, either I need to know how to send this data to Eloqua directly from my external form page using AJAX, or I need to know how to get that PHP page to submit that data to Eloqua in turn. But I'm hoping for a solution on the external form's page, since I don't need to do anything to the data before it goes to Eloqua.
Thanks!