1$.ajax({
2 url: "/something", // the url we want to send and get data from
3 type: "GET", // type of the data we send (POST/GET)
4 data: {p1: "This is our data"}, // the data we want to send
5 success: function(data){ // when successfully sent data and returned
6 // do something with the returned data
7 console.log(data);
8 }
9}).done(function(){
10 // this part will run when we send and return successfully
11 console.log("Success.");
12}).fail(function(){
13 // this part will run when an error occurres
14 console.log("An error has occurred.");
15}).always(function(){
16 // this part will always run no matter what
17 console.log("Complete.");
18});