0

In firefox or chrome or other browsers i dont have this problem but in ie not working.

$(document).ready(function(){
$('#divplayer').load("/player/index.php");
    $("a.eklebeni").live('click', function(event){
        event.preventDefault();
        $('.png', this).attr('src', 'img/eklendi.png');
        $.get($(this).attr("href"), function(data) {
        $('#divplayer').html('<img src="img/player.png" class="png" alt="" />');
        $('#divplayer').load("/player/index.php");
        });
});

I dont know why but load function not working ?

Thanks

  • **Why not? What happens?** What do you see in the dev tools? – SLaks May 24 '11 at 16:41
  • Look at the JavaSript console and see if there are any reported errors, then post the errors. And whatever line of script/html might be implicated. – David Thomas May 24 '11 at 16:45
  • 1
    Perhaps the answer lies in http://stackoverflow.com/questions/1061525/ ? – Rob Cowie May 24 '11 at 16:46
  • All versions of IE. And javascript console not showing error this is facebook iframe application. You can look at apps.facebook.com/muzikarsivi . but player load script not working – Korcan Ergun May 24 '11 at 16:49

2 Answers2

1

Neither of these a jQuery related solutions... but they're both things you should be aware of in the difference between IE and W3C (everyone else). It looks like you might have coded for the latter which is why in IE it's not working as you expect, but without knowing what's not working this is a big of a WAG.

In IE, window.event gives you access to the event (not the first argument passed to the event handling code) so your function should be:

//...
.live('click',function(event) {
  event=event||window.event;
//...

To prevent an event in W3C you should use event.preventDefault(), in IE you need to set event.returnValue=false in order to prevent the default event. Which means changing a change to event.preventDefault():

if (event.preventDefault) {event.preventDefault():}
else {event.returnValue=false;}
Rudu
  • 15,682
  • 4
  • 47
  • 63
  • 1
    You don't have to do this with jQuery, it normalizes the `event` object (http://api.jquery.com/category/events/event-object/). It is always passed to the event handler. – Felix Kling May 24 '11 at 17:06
1

I've had this happen a million times with IE caching the content, which doesn't help because there will be no errors or problems reported, it just won't work. Try something like this and see what happens:

$('#divplayer').load("/player/index.php?timestamp=" + (+new Date));
Eli
  • 17,397
  • 4
  • 36
  • 49