1

I am exploring jQuery.get() ajax call to load a website content into my HTML page. The problem is that I am not too sure whether I am using the command correctly

For example: I would like to load the following website content from google to my HTML page.

I use the following jQuery script to do it :

$.get("http://www.google.com/maps/place?source=uds&q=cafe&cid=10972320184180601304");

Hoping that it will give me back the website content so that I can append it into my HTML page. I cant seem to get any response back from the $.get(...).

Am I going to the right direction here or should I be looking for a different approach altogether ?

Cheers

1
  • 1
    I just found this from : "i think it is worth mentioning that some browsers don't accept loading a page from another source. ie, in firefox you can't use .load("abc.com"); in safari it does seem to work." (api.jquery.com/load) Commented Feb 26, 2010 at 1:05

2 Answers 2

1

I think that the browser security model prevents you from doing this. The best you'll be able to achieve is having the other page shown in an iframe.

See: http://en.wikipedia.org/wiki/Cross-site_scripting

Sign up to request clarification or add additional context in comments.

1 Comment

I found a good jQuery plugin called Fancy Box (fancybox.net) to load website within iFrame. It is very to use.
0

Try something like this:

<div id="foo"></div> 

And your js:

$("#foo").load("http://someurl"); 

1 Comment

I tried the $("#foo").load("http://someurl");. It does not work. It works if I specify an internal html page within my directory

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.