0

I have been trying for some time to get this to submit.

Not sure how to place listners to make this submit. I need all of it in the same file since this is for a company developing all code internal, there is no option of including another js.js page. Also this company does not utilise PHP at all!!!

Not sure what i am doing wrong.

Would really appreciate so much if someone could help out.

Excuse my ignorance!!

  var form = new FormData();
form.append("email", "anim enim cupidata");
form.append("first_name", "ipsum pariatur adipisicing");
form.append("last_name", "officia ");
form.append("address", "elit");
form.append("city", "dolor Excepteur");
form.append("country", "ipsum");
form.append("zip", "in laboris dolor");
form.append("state", "est consequat ea pariatur");
form.append("phone", "qui dolore");
form.append("industry", "do non amet et");
form.append("org", "enim");
form.append("job_title", "dolore in");
form.append("purchasing_time_frame", "nulla irure anim sunt aliquip");
form.append("role_in_purchase_process", "elit ipsum enim");
form.append("no_of_employees", "officia incididunt nostrud occaecat");
form.append("comments", "mollit nulla nostrud Excepteur");
form.append("custom_questions", "[{\"title\":\"amet eu qui do\",\"value\":\"ipsum Duis veniam\"},{\"title\":\"cupidatat et velit nulla\",\"value\":\"eiusmod non dolore qui\"}]");

var settings = {
  "url": "https://api.zoom.us/v2/webinars/WEBID/registrants",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "multipart/form-data"
  },
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
  });
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<form>

<input name="email" placeholder="email"/>
<input name="first_name" placeholder="Name"/>
<button name="submit" type="submit">Submit</button>
</form>
Web Dev
  • 134
  • 11
  • The POST request comes back with a CORS error, meaning this API is not intended to be used from inside a browser but the backend. Also your $.ajax() code just runs when the page loads, and is not connected to your
    .
    –  Jul 08 '21 at 19:55
  • Thank so much for answering. How can I run this from backend using PHP. Also how can I connect it to my form? – Web Dev Jul 08 '21 at 20:00
  • 1
    Your form needs `action="somescript.php" method="post"` and that way you can use `$_POST["email"]` etc to get the form data inside said script. Then you make the request to the zoom API: https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php –  Jul 08 '21 at 20:59

0 Answers0