how to send data using ajax in php
$.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:
- how to target two id using jquery
- how to not wait until function response js
- store data in browser javascript
- console.log
- jquery count elements
- javascript dom cheat sheet
- js character certain count
- datatable processing
- what are callbacks
- how get height elemnt with that margin in js
- how to write in js
- checkbox on click jquery
- js start with
- javascript string to number
- javascript array.find
- how the sort function works javascript
- foreach vuejs template
- first non repeating character javascript
- jquery on dom change
- react post request
- javascript get the last element of json
- js find key by value in object
- nodejs download image from url
- add parameter submit form javascript