301 error with Ajax Source

301 error with Ajax Source

greenflashgreenflash Posts: 58Questions: 5Answers: 0
edited January 2012 in Bug reports
I've got a site that's returning a 301 error when using dataTables with an Ajax source, and the table just hangs with the processing message. However using jQuery Ajax requests outside DataTables works OK.

I can't see anything in the forums about this - just wondering if anybody's got any ideas? I'm running DataTables 1.8.3dev from 16 Sep 11 and jQuery 1.6.4. It's dificult for me to update the site with the latest jQuery and DataTables, so I haven't been able to test whether the problem's still there with the latest versions.

Campbell

Replies

  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    301 isn't an HTTP error code - it means that the resource has moved. The browser's XHR control should automatically follow the redirect.

    Can you give us a link to your page please?

    Allan
  • greenflashgreenflash Posts: 58Questions: 5Answers: 0
    Thanks. I'll send you a link off-forum.

    Campbell
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Thanks for the link :-). Talked to Campbell offline about this, but for anyone else interested in this post in future the issue was a cross domain request. The page loaded was https://, however the Ajax request for the table data was http://. So:

    Instead of loading from:
    http://domain.com/

    Instead just use a relative URL:
    /

    Allan
  • greenflashgreenflash Posts: 58Questions: 5Answers: 0
    Many thanks for the fast response Allan - this fixes the problem.

    Campbell
This discussion has been closed.