1
How do I use only one script for multiple forms?
<script>
$(document).ready(function() {
$("#formPost").submit(function() {
var dados = $(this).serialize();
$.ajax({
type: 'POST',
url: 'https://jsonplaceholder.typicode.com/posts',
data: dados,
success: function(data) {
}
});
return false;
});
});
</script>
<form action="" method="POST" id="formPost">
<input type="text" name="title" />
<input type="text" name="body" />
<input type="submit" value="Enviar" />
</form>
Thanks in advance!
Thanks brother! It worked!
– cristy