Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 11 years ago

#4765 closed enhancement (invalid)

Ajax/Load, "expected ';' " Bug with internet explorer 6 / 7

Reported by: D.van Loon Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: load ie Cc:
Blocked by: Blocking:

Description (last modified by dmethvin)

I was making an Ajax function to load html from another page within my Sharepoint site. To achieve this goal I used the following code.


<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>

<div id="mydiv"></div>

<script type="text/javascript">

$('#mydiv').load(('http://mylocalurl/page.html .ms-listviewtable'), {}, function(responseText,textStatus,XMLHttpRequest){loadResult(responseText,textStatus,XMLHttpRequest);});

function loadResult(responseText,textStatus,XMLHttpRequest) {

alert('I am succesfully called' );




What happens:

  • The target div is correctly filled with the content of the page
  • the alert is called.
  • in IE, a Javascript error appears "expected ';'"

Note #1, the line-number of the javascript error varies between refreshes. It appears on ridiculously high line numbers. Note #2, Firefox does not show the error, nor does the error console or Firebug show any error Note #3, the error dissapears when the above script is reduced to an alert.

if it helps: A blogger had a similar problem with the get command, he indicated that the problem occurs in IE when specifying datatype: 'SCRIPT' when the actual call returns html.

Also: The error cannot be reproduced when creating two simple html pages, and having 'load' get the other. The error seems to origin from the fact that sharepoint pages are shockfull of included and inline script. Perhaps a toggle to the 'load' command to choose between reading the response or running the response (which it does now ) would solve the problem.

Alternatively I tried to achieve my goal with the 'get' command, however when 'get'ting the html page it can not be traversed through css identifiers ( $('div') works, $('div.myclassname') does not.

Change History (3)

comment:1 Changed 14 years ago by dmethvin

Description: modified (diff)

Is the page being hosted on http://mylocalurl? If not then this is a cross-domain request.

comment:2 Changed 14 years ago by D.van Loon

The page is not hosted locally, in the actual solution however the html is retrieved through a local proxy ( making it a local-domain request ).

( note that if it where a cross-domain request, firefox would have given me all kinds of trouble. Which it isn't. )

The core of the problems resides in the fact that all IE browsers ( I managed to test IE 6, IE 7 and IE 8 ) seem to try and run the html that is being 'load'ed. Whereas Firefox simply reads the html ( which is the desired behavior in this case, and the reason this is a feature-req. not a bug )

comment:5 Changed 13 years ago by john

Resolution: invalid
Status: newclosed

All I can figure is that the content/script that you're loading is malformed in such a way that only IE catching the error. I'd suggest checking the loaded script using a tool like JSLint.

Note: See TracTickets for help on using tickets.