Can someone please help me breakdown the statement below… base_url was originally pointing to what I can only assume was a directory that contained a .csv file.
Given that I have a custom .csv file on my server, I changed the address of the base_url, but I’m not seeing any data.
I have about a million questions around this with a VERY SHORT deadline. Any help would be greatly appreciated.
BTW… I’ve looked through the JQUERY site another sites to try and understand.. Any help would be greatly appreciated.
$.getJSON(this.base_url+"?callback=?", {cmd:"getMakes", year:"2009"}, function(data) {
//The 'data' variable contains all response data.
var makes = data.Makes;
for (var i = 0; i < makes.length; i++)
{
//You can now do what you like with the response data
alert(makes[i].make_display);
}
});
From looking at the syntax of the script and the context it is being used in, I will throw it out there to say, ‘this.base_url’ is not supposed to be a .CSV file.
First,
$.getJSON, will set a GET request to your webserver. If it was just a GET request for a CSV file, it would make all the sense, as you are GETting the CSV file. But, the JSON keyword was added, meaning you are expecting a properly formatted JSON response to your GET request.Secondly, you are adding GET data,
?cmd=getMakes&year=2009. A CSV file by nature is a flat file on the filesystem. It is not a smart file, meaning it is not driven by logic, unless you do a redirect within your .htaccess file or MIME type modifications.You are probably looking for a file other than a .csv. Some framework allow you to interpret a link such as
http://domain.com/api/function, which looks like a url with the extension omitted.