I am using this plugin for a voting system like stackoverflow: https://github.com/janosgyerik/jquery-upvote
But after i followed all instructions, Ajax call do not work !
Here my javascript code:
$(function() {
var callback = function(data) {
alert("test1"); // <--------- ALERTED
$.ajax({
url: 'http://localhost/test.php',
type: 'post',
data: { id: data.id, up: data.upvoted, down: data.downvoted, star: data.starred },
success: function(data) {
alert("test2"); // <--------- NOT ALERTED
}
});
};
$('#topic').upvote({id: 123, callback: callback});
});
Html code:
<div id="topic" class="upvote">
<a class="upvote"></a>
<span class="count">0</span>
<a class="downvote"></a>
<a class="star"></a>
</div>
I get TEST1
alerted, but TEST2
don't !
Inside test.php
i wrote only: echo "test"; // just for test
and link is right and work well.