jQuery ajax querying a PHP script
<pre><code>&lt;html&gt;
&lt;head&gt;

&lt;title&gt;Testing AJAX&lt;/title&gt;

&lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;

&lt;script&gt;
    function init() {
        $("#form1").submit(submitForm);
    }

    function submitForm() {
        var paramValue = $("#param_input").val();

        $.ajax({  
                type: "GET", 
                url: 'http//xxx.edu/xxx/autocomplete.php', 
                data: {
                    query: paramValue
                },  
                dataType: "json",
                complete: function(data){  
                    alert(JSON.stringify(data)); 
                }  
        }); 
    }

    // On page load
    $(document).ready(init);

&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;form id="form1" name="form1_name" action="" &gt;
&lt;label for="find"&gt;Value&lt;/label&gt;
&lt;input type="text" name="param" id="param_input" /&gt;
&lt;input type="submit" name="button" id="button" value="Find"&gt;  
&lt;/form&gt;

&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p>I really want to be able to query my PHP script (which returns a <code>JSON</code> via <code>json_encode()</code>) and use that <code>JSON</code> information. </p>

<p>Right now the alert box says this:</p>

<pre><code>{"readyState":0,"responseText":"","status":0,"statusText":"error"}
</code></pre>

<p>So I'm doing something wrong. Any ideas? I'm all new to AJAX / jQuery.</p>

<p><strong>EDIT</strong>: added dataType: "json" but that did not help - still returning wrong JSON stuff...</p>
