First of all, thanks for checking out my problem and for any help you can give!
Ok, as the name says, I need to call the php function from my index page, which adds a new record to my database as a vote using jQuery Ajax. This function will return a single integer, which will then be printed inside the button of the form in which it was called.
Does anyone have an idea on how I will do this? Any guidance appreciated!
Edit:
So if I'm using a template object I can just call the
function using ajax and it will return the output?
What would I use as the URL? index.php?
Such as...
function DoVote() {
$.ajax({
type:'POST',
url: 'index.php',
success: function(data) {
$('#voteText').html(data);
}
});
And the action action attribute is hosted, I guess?
source
share