i'm building a social app with node js and i want when someone click like button to update total likes but without reloading the page! how can achieve this? i tried with ajax call like this:
$('.imgInfo').click(function (e) {
e.preventDefault();
var link=$(this).attr('href');
var fd = new FormData($(this)[0]);
$.ajax({
url: link,
data: fd,
processData: false,
contentType: false,
type: 'GET',
success: function(data){
$("body").html(data);
}
});
via thomas g
No comments:
Post a Comment