Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14094 closed bug (notabug)

$.getScript Internet Explorer

Reported by: markus.wagner@… Owned by:
Priority: high Milestone: 1.11/2.1
Component: ajax Version: 1.10.1
Keywords: Cc:
Blocked by: Blocking:

Description

If i call $.getScript on a script that doesn't exist (webserver returns html error page instead of script).

-> Internet Explorer in combination with jQuery 1.10.1 throw

SCRIPT1002: Syntax error 

  $.getScript('failscript', data, successCallback)
                .fail(errorCallback)
                .done(callback);

Change History (15)

comment:1 Changed 6 years ago by anonymous

 $.getScript('failscript', successCallback)
                .fail(errorCallback)
                .done(callback);

comment:2 Changed 6 years ago by timmywil

Resolution: worksforme
Status: newclosed

I am unable to reproduce: http://jsbin.com/irakez/1/edit

comment:3 Changed 6 years ago by markus.wagner@…

with your code, I get a syntax error in IE9 and 10

comment:4 Changed 6 years ago by gegennoobs@…

i'm getting the same error with your created script: SCRIPT1002: Syntax error runner, line 1 character 1 SCRIPT5007: Unable to get property 'proxyconsole' of undefined or null reference runner, line 7 character 3

http://i.imgur.com/bjo80Ei.png

i'm using IE10

comment:5 Changed 6 years ago by timmywil

Component: unfiledajax
Milestone: None1.10.3/2.0.4
Priority: undecidedhigh
Resolution: worksforme
Status: closedreopened

Ah, I was looking at the firebug lite console and the error went to the F12 console. There is an error there.

comment:6 Changed 6 years ago by timmywil

Status: reopenedopen

comment:7 Changed 6 years ago by anonymous

the same issue with $.getJSON

comment:8 Changed 6 years ago by anonymous

I guess you are getting this console message only in jsbin.com

Try using jsfiddle.net to reproduce this issue. Maybe we are actually debugging jsbin.com instead of jquery core. runner.js seems not to be a jquery part.

In jsfiddle the console output is something like "access denied".

comment:9 Changed 6 years ago by markus.wagner@…

no we are getting this message also in a local testenvironment. if you build a simple html page and start it with the internet explorer 9/10.

comment:10 Changed 6 years ago by anonymous

sorry i was not even able to reproduce this error locally. I only get the console output "fail". What is expected.

can you provide us with some more information about your system (exact browser version, operating system).

comment:11 Changed 6 years ago by anonymous

I think your problem is you send the request just in a simple html page without a webserver. So your response in the Internet Explorer is nothing and you don't get an error. But try this page:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="elem"></div>
  <script src="http://code.jquery.com/jquery-git.js"></script>
  <script>
  $.getScript('test.html', function() {
  console.log('success');
}).done(function(){
  console.log('done');
}).fail(function(){
  console.log('fail');
});
</script>
</body>
</html>

name your page test.html and send the request to test.html (it's important you get some data!) then you get a syntax error in IE9/10

comment:12 Changed 6 years ago by anonymous

Ok. Now I was able to reproduce your issue. But in fact it is not a bug:

jQuery has a problem with your loaded content.

$.getScript functions expects a Javascript file to be loaded not html!

this is also specified in the jquery api documentation.

http://api.jquery.com/jQuery.getScript/

So I would not consider this as a bug and suggest to close this ticket.

comment:13 Changed 6 years ago by dmethvin

Milestone: 1.10.3/2.0.41.11/2.1

Bulk update for new milestone

comment:14 Changed 6 years ago by xiaotianpop@…

I verified on IE 10 with jQuery version 2.1.0-pre, this issue has been fixed.

comment:15 Changed 6 years ago by dmethvin

Resolution: notabug
Status: openclosed

Javascript syntax errors can't be detected by the .error() for this case, as documented.

Note: See TracTickets for help on using tickets.