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.");
}
});
how to get data from db using ajax
<script>
$(function(){
$(".like").click(function(){
var postid = $(this).attr("id");
$.ajax({
type:'POST',
url:'addlike.php',
data:'id='+postid,
success:function(data){
if(data=="you already liked this post"){
alert(data);
}
else{
$('a#'+postid).html(data);
}
}
});
});
});
</script>
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