Changes between Initial Version and Version 1 of Ticket #7225


Ignore:
Timestamp:
Apr 7, 2011, 5:43:34 AM (10 years ago)
Author:
rdworth
Comment:

I was only able to reproduce the error you've got in Firefox 4 by attempting your example in a local file. When I serve the file from a web server, no error. My first assumption was that Ajax from a local file isn't supported in this browser, but I wasn't able to get the same error with a minimal local file test case using only jQuery:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<div></div>
<script>
$("div").load("otherfile.html");
</script>

It seems jQuery supports Ajax from a local file in Firefox 4, not sure if it supports it in all supported browsers, nor whether Tabs should. But the difference seems to be in Tabs using the $.ajax success callback whereas .load() uses the $.ajax complete callback. Tabs does basically this right now:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<div></div>
<script>
$.ajax({
  url: "otherfile.html",
  success: function( r ) {
    $("div").html( r );
  }
});
</script>

where if it followed the pattern in .load() it would look (minimally) something more like:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<div></div>
<script>
$.ajax({
  url: "otherfile.html",
  complete: function( jqXHR ) {
    $("div").html( jqXHR.responseText );
  }
});
</script>

When each of the last two examples are served from a web server in Firefox 4, no error, and you see the content from otherfile.html. When the same are run from a local file, the first has the error noted by slomatt while the second displays the Ajax-from-local-file content of the otherfile.html. Perhaps we should see if this inconsistency is considered a bug by jQuery.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7225

    • Property Summary changed from Issue with JQuery UI tabs loading tab content using AJAX to Tabs: error when loading Ajax tab content from tabs in local file
  • Ticket #7225 – Description

    initial v1  
    3838</html>
    3939}}}
     40
     41So it seems there is some inconsistency in how well jQuery's $.ajax success and complete callbacks work depending on whether the original file is local. We should see if that's considered a jQuery bug before going any further.