how to pass value from javascript to php 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:
- check ip json
- Expected an assignment or function call and instead saw an expression
- json introduction
- js get current time minutes
- has own propriety javascrip
- nuxtjs http multiple proxy
- javascript days until end of month
- function if else javascript
- jquery get all classes of a div
- vuejs send required props to dynamic component
- big o theory
- show ad on facebook game
- fileupload progress bar in axios
- alternate color to table row jquery
- javascript ajax post form data
- javascript increment alphabet
- access method globally js
- how to remove event listener in jquery
- can you get reinfected with the coronavirus
- jquery function called onDeleteMovie. This function should be invoked upon clicking the Delete button of each one of the movie templates
- settimout jquery
- json remove "
- capitalize first letter of each word javascript
- check if is array or object javascript