Get php results with jquery ajax <p>I don't know why I am having a hard time with this, but it's about time I came up for air and asked the question.</p> <p>What is the best way to call a php file with jquery ajax, have it process some inputs via $_GET, return those results and again use ajax to replace the content of a div?</p> <p>So far, I can call the php file, and in the success of the jquery ajax call I get an alert of the text.</p> <pre><code>$.ajax({ url: "xxx/xxx.php", type: "GET", data: data, cache: false, success: function (html) { alert("HTLM = " + html); $('#product-list').html(html); } }); </code></pre> <p>I set the php function to echo the result, the alert spits out the html from the php file. But I get a side effect. I get the code that the php generated echoed at the top of the page. So php is doing it's job (by echoing the content). Next jquery is doing it's job by replacing the div's content with the values from the php file.</p> <p>How do I stop the php file from echoing the stuff at the top of the page?</p> <p>Sample code being echoed from php and alerted in the success of jquery ajax</p> <p>HTML = </p> <pre><code>&lt;div class="quarter"&gt; &lt;div class="thumb"&gt; &lt;a href="productinfo.php?prod-code=Y-32Z&amp;cat=bw&amp;sub="&gt; &lt;img src="products/thumbs/no_thumb.gif" alt="No Image" border="0" /&gt; &lt;/a&gt; &lt;/div&gt; &lt;div class="labels"&gt;&lt;span class="new-label"&gt;New&lt;/span&gt;&lt;/div&gt; &lt;p&gt;&lt;span class="prod-name"&gt;32OZ YARD&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span class="prod-code"&gt;Y-32Z&lt;/span&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>Thanks!!!</p> <p>-Kris</p>