Thanks Klaus, much appreciated.
Regards,
David
Klaus Hartl wrote:
> David schrieb:
>
>> Hi,
>>
>> I am trying to get some html content to load into a div when a hyperlink
>> is clicked. The code I have is very simple and works perfectly in IE7,
>> but no matter what I do I can't get Firefox to use the load() function.
>> The code is below:
>>
>> <HTML>
>> <HEAD>
>> <TITLE> Document </TITLE>
>> <script src="jquery-104.js" language="javascript"
>> type="text/javascript"></script>
>> <script>
>> $(document).ready(function(){
>> $("a").click(function(){
>> $("#test").load(this.href);
>> return false;
>> });
>> });
>> </script>
>>
>> </HEAD>
>>
>> <BODY>
>> <div id=test></div>
>> <p>
>> <a href="http://www.google.com">Click here</a>
>> </p>
>> </BODY>
>> </HTML>
>>
>> When I click the link in IE7, the div gets populated with the output
>> from the external html page. When I click it in Firefox, it simply acts
>> as a regular link and redirects to the external page. After a thorough
>> search of the mailing list I made the following change:
>>
>> $("a").click(function(e){
>> e.preventDefault();
>> e.stopPropagation ();
>> $("div#test").load(this.href);
>> return false;
>> });
>>
>> But the only difference that it makes is that Firefox now doesn't do
>> anything.
>>
>> I've also tried putting an alert before and after the load() function.
>> The both alerts get displayed in IE, but only the first one show in
>> Firefox, which make me think it is bailing out of the click() function
>> before load() is getting called.
>>
>> ie.
>> alert("about to load");
>> $("div#test").load(this.href);
>> alert("Page Loaded");
>> return false;
>>
>> The version of Firefox I am running is the latest (1.5.0.9).
>>
>> Any idea tips, etc. would be most welcome.
>>
>> Thanks,
>>
>> David
>>
>
>
> You cannot load content from a ressource that is not on your server via XHR.
>
> There should pop up an error in the JavaScript console in Firefox.
>
> You have to either create a proxy server on your own server (e.g. a php
> skript that gets the html from google.com or elsewhere and returns it to
> you) or if you simply want to embed it, try using an object element:
>
> http://intranation.com/test-cases/object-vs-iframe/
>
> -- Klaus
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
>
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/