title: AJAX, POST, JSON, and PHP: How do I do it?
body: <p>How do I send AJAX data through $.ajax() in JavaScript via type: "POST" using JSON data formatting and how do I receive the data in a PHP script (through $_POST??) and put it into an array so I can use it?  I've been kicking at this for hours and I have no idea what I'm doing wrong.  If someone could post the JS and PHP code for sending and receiving JSON formatted data, I would be eternally grateful!!!!!</p>
  
  <p>JS Code:</p>
  
  <pre><code>$.ajax({
                  type: "POST",
                  url: $(location).attr('protocol') + "//" + $(location).attr('hostname') + "/ajax/rate.php",
                  data: {
                      "value1": 1,
                      "value2": 2,
                      "value3": 3,
                      "value4": 4,
                      "value5": 5
                  },
                  dataType: "json"
              });
  </code></pre>
  
  <p>PHP Code:</p>
  
  <p>I was just using $_POST["value1"], etc., to get that value.  On that note, is there a way to make the ajax request GET instead AND open up a new window with that GET data on it so I can see what's going on??</p>