1 week ago, i decided to start adding AJAX and more jquery to my Website. I think, the "combination" of PHP / Jquery / AJAX is the best thing ever.
Now i want to create a "like - system" in my community board. I did something similar already:
$(function(){
$('.action-button.like').click(function(){
//ajax part
var articleId = $('.article-Id').html();
$.ajax({
type: "GET",
async: true,
url: '/wiki/parts/likeArticle.php',
data: { 'articleId': articleId },
//change button
success: function (msg){
$('.action-button.like span').fadeOut(400);
},
error: function (err)
{ alert(err.responseText)}
});
});
});
as you can see, the button / element disappears after a click()
on it. PHP data: the .php file "inserts the like" into the database ...
So - this works great ! Back to my question: After an user likes the post, i want to display a container with all users, which did this before.
I'm asking this, because i know how to do this / I have an Idea how i can realise my little project, but i dont know, if this is the propper way :)
My solution:
in $.ajax: I want to create a function on "success:" (and a new .php file, which loads all users / "likers") the function uses .load()
and loads the file, so everything should be done right, shouldn't it ?
I hope you understand my problem, Greets :)
Aucun commentaire:
Enregistrer un commentaire