jquery ajax form submit example
// jQuery ajax form submit example, runs when form is submitted
$("#myFormID").submit(function(e) {
e.preventDefault(); // prevent actual form submit
var form = $(this);
var url = form.attr('action'); //get submit url [replace url here if desired]
$.ajax({
type: "POST",
url: url,
data: form.serialize(), // serializes form input
success: function(data){
console.log(data);
}
});
});$.ajax({
type: "POST",
url: "upload.php",
data: { name:name, mobile:mobile, address:address, city:city },
dataType: "json",
success: function(result){
}
});
Also in JavaScript:
- can I pass function as prop on route change
- dynamically add id ro div in angular using forloop ngfor
- get form data as object jquery
- javascript var in quotes
- Javascript compare two arrays
- javascript object array sum of values in object
- javascript audio duration property returns infinity
- add 2 for hours in date timestamp js
- how to give a person a role by id in discord.js
- getting value from radio button javascript
- how to check if object is undefined in javascript
- form in react
- react cloud foundry nginx 404
- jquery get relative position of element
- angular get response headers
- get div id javascript
- minus month javascript date
- core.js:13987 'mat-date-range-input' is not a known element
- javascript developer salary
- AngularJS SQL
- how to delete a line in vs code
- parse integer javascript
- find char in string javascript
- factorial javascript