Created
February 9, 2021 17:19
-
-
Save slav123/5a8985cf697446c8106d018c36242d60 to your computer and use it in GitHub Desktop.
json ajax form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsonData = $('#formularz').serializeArray().map(function(x){this[x.name] = x.value; return this;}.bind({}))[0] | |
$.ajax({ | |
type: "POST", | |
url: "", | |
data: JSON.stringify(jsonData), | |
success: function(data){ | |
if (data.error == "") { | |
$('#formWrapper').html("<p>Dziekujemy za wysłanie wiadomości</p>"); | |
} else { | |
console.log(data.error); | |
$('#formWrapper').html("<p>Wysyłanie wiadomości nie powiodło się.</p>"); | |
} | |
}, | |
dataType: "json", | |
contentType : "application/json" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment