Why ajax is sending multiple POSTs?
Hi
In the video.. why ajax sends multiple POSTs? sometimes, 2, 3, 4 or 5 times..
https://www.jassimrahma.net/temp/2017-07-05_0325.swf
I have nothing in my PHP does that..
Here is the code:
- $("#frmContact").on("submit", function (event) {
- event.preventDefault();
- var formData = new FormData();
- formData.append("savanna_account", Savanna.savanna_account);
- formData.append("customer", customer_id);
- if (e.component.option("tag"))
- {
- formData.append("contact_id", contact_id);
- }
- formData.append("category", "cat");
- formData.append("details", "details");
- formData.append("user_id", Savanna.user_id);
- $.ajax({
- type: "POST",
- url: 'https://www.mydomain.com/save_new_contact.php',
- async: true,
- data: formData,
- processData: false,
- contentType: false,
- beforeSend: function () {
- // disable button
- },
- success: function (data) {
- // close window
- },
- error: function (xhr, status, error) {
- alert('Failed to save contact!<br>Please check your connection.');
- }
- });
- });
Thanks,