JQuery On Click Function Nothing Happening
This jQuery function is meant to post the value of num to a PHP page and then echo it in the correct status class, any ideas why nothing is happening, I have downloaded jQuery and
Solution 1:
Instead of $.post
change it to $.ajax
You could re-arrange the parameters to get it to work with $.post, but it looks like the code you have is meant to be run with $.ajax.
Also, inside of here
$(document).ready(function() {
$('.eventer > .button').click(function () {
var self = this;
$.post('javas.php', function (data) {
$(self).closest('.eventer').find('.status').html(data);
})
});
alert("lol");
});
Are you sure you didn't mean:
$(document).ready(function() {
$('.eventer > .button').click(function () {
ajax_post();
});
alert("lol");
});
Solution 2:
If you try to put an alert in the click action, what does it happen ?
Perhaps your action isn't added on the object you think.
Solution 3:
I think you have the order of the parameters in the call to $.post wrong. It should be:
$.post("url", { data:'something' }, function(result){
//callback
});
Solution 4:
It looks like you are mixing up the jQuery post and ajax methods. Try adding the data argument (your num variable) in your post.
$('.eventer > .button').click(function () {
var self = this;
$.post('javas.php', num,function (data) {
$(self).closest('.eventer').find('.status').html(data);
})
});
Post a Comment for "JQuery On Click Function Nothing Happening"