Creating leads VIA PHP
Hello,
This is my first time really working with Marketo and I am running into a few issues. I have a custom PHP form that when submitted runs a quick AJAX call to post the data to a php form (using curl). On form submission this form should create a new lead in Marketo.
*Not posting form as it is very long.
example form fields.
<input type="text" name="fullName" required="required"/>
<input type="text" name="email" required="required"/>
<input type="text" name="jobTitle" required="required"/>
$("#mcontact").submit(function(event) {
var ajaxRequest;
/* Stop form from submitting normally */
event.preventDefault();
/* Get from elements values */
var values = $(this).serialize();
console.log(values);
/* Send the data using post and put the results in a div */
ajaxRequest= $.ajax({
url: "/wp-content/themes/dynamic17/inc/marketo_sub.php",
type: "post",
data: values
});
/* request cab be abort by ajaxRequest.abort() */
ajaxRequest.done(function (response, textStatus, jqXHR){
// show successfully for submit message
$('.main-contact-header').hide();
$('#mcontact').hide();
$('.form_success').show();
});
/* On failure of request this function will be called */
ajaxRequest.fail(function (){
// show error
$("#result").html('There is error while submit');
});
});I am looking at the example for: http://developers.marketo.com/blog/add-salesperson-data-to-marketo/ on how to do the next step but am getting stuck. How can I pass the form data into marketo_sub.php so that Marketo can then read it and create a lead.