I have used JQuery with Ajax successfully before, but only for form elements (using GET and POST). I am trying to figure out how to do use Jquery and AJAX for non-form elements. I have a list like this:
- item1
- item2
When the user clicks on an item, I need it to hit the server and write the item number in the database without it refreshing the page.
Can someone pleasehelp me?
Edit: Using PHP
Here is the code I am working with but don’t know how to use properly:
$(document).ready(function(){
$("#rating_toggle").click(function() {
$.ajax({
type: "POST",
url: "rating/test",
data: "????????",
success: function(data){
alert(data);
}
});
return false;
});
});
You can still send in a ajax request clicking elements which are non form elements..
Remove the return false from your Request .. That is not required..