AnsweredAssumed Answered

Creating leads VIA PHP

Question asked by a62e079d7671e15df47f4edbbf354965cd6d2fa9 on Mar 29, 2017
Latest reply on Mar 29, 2017 by Sanford Whiteman



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 */
  /* Get from elements values */
  var values = $(this).serialize();
  /* 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
  /* On failure of request this function will be called  */ (){
    // show error
    $("#result").html('There is error while submit');


I am looking at the example for: 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.