title: Ajax only effects 1 button, instead of all buttons
body: <p>So I want to set up my index.php so that when the like button is clicked, ajax is used to go to liked_button.php and change the look of the button to 'Liked'. This works, for one button, the first button. It doesn't work for all the other buttons on the page. Liking another button other than the first button, makes it appear as if the first button was liked. So my question is, how do I apply this ajax code to 'ALL' of the like buttons on index.php?</p>
  
  <p>Here is the index.php :</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;head&gt;
  
  &lt;?php
      include('header.php');
  ?&gt;
  
  &lt;script&gt;
  $(document).ready(function(){
      $(".button").click(function(){
           $.ajax({url:"liked_button.php",success:function(result){
               $("#like_system").html(result);
              }});
          });
      });
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;link type="text/css" rel="stylesheet" href="index.css"&gt;
  &lt;body&gt;
  
  &lt;?php
  
  $conn = mysqli_connect("localhost","root","") or die ("No SQLI");
      mysqli_select_db($conn, "sample") or die ("No DB");
  
  $sqli = "SELECT * FROM `photos` ORDER BY `id` DESC";
  
  $result = mysqli_query($conn, $sqli) or die ("No query");
  
  while($row = mysqli_fetch_assoc($result))    
  
  {
  $username = $row['username'];
  $title = $row['title'];
  $description = $row['description'];
  $image_name = $row['image_name'];
  $image_id = $row['image_id'];
  $random_directory = $row['random_direc'];
  $date = date('Y-m-d');
  
  $image_info = "http://localhost/splindr_2.0/photos/$random_directory/$image_id";
  
  echo "&lt;div id=contentWrapper'&gt;
            &lt;div id='photo'&gt;
                &lt;div id='actual_image'&gt;
                   &lt;img src='$image_info'&gt;
                &lt;/div&gt;          
                &lt;div id='like_system'&gt;&lt;button type='button' class='button'  name='button'&gt;Like&lt;/button&gt;&lt;/div&gt;     
                      &lt;div id='info_wrapper'&gt;
                         &lt;div id='info_header'&gt;Title: $title &amp;nbsp By: $username &amp;nbsp  Date: $date&lt;/div&gt;
                             &lt;div id='description'&gt;$description&lt;/div&gt;
                      &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;";//end contentWrapper
  
  }
  
  ?&gt; 
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the liked_button.php :</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;link type="text/css" rel="stylesheet" href="liked_button.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;button type="button" id="button_pressed"&gt;Liked&lt;/button&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>