title: Sending Ajax data to current page
body: <p>I've got some data that will be used as part of an image gallery but I don't want to refresh the page between loading the data (there are interface items that I wish to stay visible).  However when I submit the data to the same page via ajax JS registers a successful execution of the code (the alert box shows up) but PHP fails to harvest the data.</p>
  
  <p>My JQuery looks like this</p>
  
  <pre><code>$(".gallery_thumbnail").click(function(){
    var id=$(this).attr("data-id");
    $.ajax({
      type: "GET",
      url: "test.php",
      data: {newid:id},
      dataType: 'text',
      success:function(result){
        // Test what is returned from the server
        alert(result);
      }
    });
  });
  </code></pre>
  
  <p>And my PHP looks like this\</p>
  
  <pre><code>if(isset($_GET['newid'])){
    echo "success";
  }
  else{
    echo "fail";
  }
  </code></pre>
  
  <p>I've seen similar questions and tried copy and pasting the answers but I can't seem to get this to work.  I've also tried for the url parameter:</p>
  
  <pre><code>http://localhost/test.php and simply removing the url parameter altogther.
  </code></pre>