jquery ajax get
$.ajax({
url: "www.site.com/page",
success: function(data){
$('#data').text(data);
},
error: function(){
alert("There was an error.");
}
});
jquery ajax get
$.ajax({
url: "www.site.com/page",
success: function(data){
$('#data').text(data);
},
error: function(){
alert("There was an error.");
}
});
make ajax request post jquery
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
})
ajax get js
let xhr = new XMLHttpRequest();
xhr.open("GET", "une/url");
xhr.responseType = "json";
xhr.send();
xhr.onload = function(){
if (xhr.status != 200){
alert("Erreur " + xhr.status + " : " + xhr.statusText);
}else{
alert(xhr.response.length + " octets téléchargés\n" + JSON.stringify(xhr.response));
}
};
xhr.onerror = function(){
alert("La requête a échoué");
};
xhr.onprogress = function(event){
if (event.lengthComputable){
alert(event.loaded + " octets reçus sur un total de " + event.total);
}
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us