how to send data using ajax
$.ajax({
url: "/something", // the url we want to send and get data from
type: "GET", // type of the data we send (POST/GET)
data: {p1: "This is our data"}, // the data we want to send
success: function(data){ // when successfully sent data and returned
// do something with the returned data
console.log(data);
}
}).done(function(){
// this part will run when we send and return successfully
console.log("Success.");
}).fail(function(){
// this part will run when an error occurres
console.log("An error has occurred.");
}).always(function(){
// this part will always run no matter what
console.log("Complete.");
});
Also in JavaScript:
- compare two arrays and make sure there are no duplicates js
- for in and for of in js
- location javascript redirect
- javascript date double digit month
- jquery remove multiple class
- create and append element in javascript
- javascript countdown 1 minute
- add coustom handlechange fprmik
- javascript how to check if image exists
- javascript check if two date are ugual
- javascript newline in alert
- javascript set class
- javascript replace big list
- passing a variable to the width style div angular
- eslint version check in react
- simple json data
- comments in js
- convert excel file to json using node js
- JSX not allowed in files with extension '.js'
- sum in javascript
- parseint js
- get random element from array js
- js loop over array of objects extract value
- react navigation stack