Joseph Toronto
Joseph Toronto

Reputation: 1892

sAjaxSource URL not matching entered parameter

I know virtually nothing about J-Query/Javascript, so this might be something obvious. I'm using the J-query plugin called Datatables. I'm trying to use the AJAX source method in accordance to the documentation here.

I'm initializing it like this:

<script>
    $(document).ready(function() {
                      $('#filetable').dataTable( {
                                              "bProcessing": true,
                                              "sAjaxSource": '/filelist.json'
                                              } );
                      } );
</script>

There's no fancy server side processing here. There's simply a file on the web server called filelist.json, and that's what I want. However my server is showing the request URL it's being given as /filelist.json?_=1396119501351 and is returning nothing since nothing exists at that URL. Where's all of those numbers and the question mark and whatnot coming from? I just want it to retrieve the file and use it as the datasource. Am I misunderstanding how this works?

Upvotes: 0

Views: 427

Answers (1)

John Cosch
John Cosch

Reputation: 123

It seems to me that the plugin is configured to set the jquery cache parameter to true, this will add a timestamp as a parameter to your request at _=1396119501351. Anything after the ? is just a parameter sent to the server, and will not effect the actual path at all. I really don't think the parameter is your problem, I assume theres another issue with your url.

For more information reference https://api.jquery.com/jQuery.ajax/

Upvotes: 1

Related Questions