views:

79

answers:

2

I posted a similiar thread before here, but after further investigation I've found that the problem is with $.ajax jsonpCallback parameter.

In the following simple code it crashes every time on the 2nd request (cache problem?)

<html>
<head>
 <title>Hello world</title>
</head>
<body>
 <span id="ClickMe">Click Me</span>
</body>
<script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready( function() {
  //console.log('Init');
  alert('asdasd');
  $("#ClickMe").click( function() {
   $.ajax({     
    url: 'http://URL-THAT-CAN-HANDLE-DIFFERENT-CALLBACK-NAMES',
    dataType: 'jsonp',
    jsonpCallback: 'myCustomCallback',
    success: function(data) {

    }
   });
  });

 });
</script>
</html>

This code will cause IE6 and IE7 to crash on the 2nd click on the Click Me-span.

Anyone now what can cause this?

+1  A: 

I'm not sure what's going on here, but this kind of situation is where http://code.google.com/p/jquery-jsonp/ comes in handy :)

Julian Aubourg
A: 

Hi, did you ever find a solution/answer to this because I think we are having the same issue with specifying jsonpCallback and IE 6/7 crashing. We are also specifying the callback name to allow for caching.

Karen
Yes in fact I did. The error is the specified callback-name. In previous version of jQuery it wasn't possible to specify that and therefore it didnt crash. I worked around this by not setting the callback name if the browser is IE6 or 7
Kenny Eliasson