Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading a CSV file using jQuery GET returns the header but no data
    text
    copied!<p>When reading a CSV file from a server using the jQuery 'GET' function I do not get any data. When I look at the code using FireBug I can see the GET request is sent and the return value is '200 OK'. Also I see that the header is returned correctly so the request is definitely made, and data is returned. This is also what I see in Wireshark. Here I see the complete contents of the CSV file is returned as a standard HTTP response.<br> But the actual data is not there in my script. Firebug shows an empty response and the 'success' function is never called. What could be wrong ?</p> <p>EDIT: An essential part of information appeared to be missing from my question. The following code runs on my local machine and is started by Aptana Studio in Firefox using the built-in test server.</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;New Web Project&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script src="jquery.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var csvData; $(document).ready(function() { $("#btnGET").click(function() { csvData = $.ajax({ type: "GET", url: "http://www.mywebsite.com/data/sample_file.csv", dataType: "text/csv", success: function () { alert("done!"+ csvData.getAllResponseHeaders()) } }); }); }) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;New Web Project Page&lt;/h1&gt; &lt;button id="btnGET"&gt;GET Data&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload