tags:

views:

28

answers:

2

Alright so I got my movies page, and under you can post a comment. I would like to add a little link on the side of the comment for the people that liked / found this comment useful. (Eventually it will +1 the number so like "I Like (3)" (3 being the number of people who voted))

Since it's movies, I do not wish to reload the page.

So how would I got on doing this?

The hardest part for me is AJAX, I can make it working in PHP, but integrating AJAX is another thing.

Any help is very appreciated!

Thank you.

+1  A: 

When using AJAX, you would be very wise to use a JavaScript library like jQuery. This makes it really easy to use AJAX and make requests to your PHP scripts. The AJAX documentation is really all you will need to achieve what you would like to do.

An example query is as simple as:

$.ajax({
  url: 'ajax/vote.php',
  success: function(data) {
    $('.result').html(data);
    alert('Load was performed.');
  }
});
Sam152
nice answer. :) beat me to it.
KennyCason
A: 

First off I recommend you start learning JQuery: http://jquery.com/ It's a nice wrapper around Javascript which has MANY plugins and built in functions. AJAX being one of them.

The JQuery AJAX API can be found here: http://api.jquery.com/jQuery.ajax/

It's example usage (from the API)

$.ajax({
  url: 'ajax/test.html',
  success: function(data) {
    $('.result').html(data);
    alert('Load was performed.');
  }
});

It also contains many other functions like JQuery.post() and JQuery.getJSON()

KennyCason