Luke
Luke

Reputation: 855

jQuery .load() not in Opera 11, but working in IE8 and firefox

The problem I am having is that the .load() function seems to be ignored? I am receiving no errors in the error log in DragonFly. The alert is just for debugging, and is working.

Strangely though, this works in IE8 as well as Fire Fox 10

I am current using jQuery 1.7.2 and opera 11.61.

$(document).ready(function(){
    //page defaulted to main
    $('#main').load('main.html');

    $('#menuAnchors > li > a').each(function(){}).           
    click(function(){        
        $('#main').load($(this).attr('href'));
        alert($(this).attr('href'));
        return false;
    });
});

The code above is targetting

<ul id ="menuAnchors" class ="menuItems">
<li><a id="menuASolarFlare" href="solarFlares.html" target="main">Solar Flares</a></li>
<li><a id="menuACurrencyConverter" href="currencyConverter.html" target="main">Currency Converter</a></li>
<li><a id="menuAXML" href="mydoc.xml" target="main">XML</a></li>
<li><a id="menuAXML" href="outPutxml" target="main">Section 1 - XML</a></li>
<li><a id="menuAMain" href="main.html" target="main">Main</a></li>
<li><a id="menuASmile" href="smile.html" target="main">Smile :D!</a></li>
<li><a id="menuAMedia" href="media.html" target="main">Media</a></li>
</ul>

Thanks :)

Upvotes: 0

Views: 621

Answers (1)

Luca
Luca

Reputation: 4273

Cross-Origin browser issue. Try deploying your HTML page on a webserver.

For more info: http://enable-cors.org/

Upvotes: 1

Related Questions