Forum Moderators: open

Message Too Old, No Replies

Help! Ajax Jquery Won't Pull Remote Page

         

bhansel

4:12 pm on Mar 4, 2010 (gmt 0)

10+ Year Member



Hello...I'm relatively new to this and need to pull content and links from an html page and have it display on another html page...but it's not working.

Here is the output page html:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Ajax and Jquery: Remote Pages</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#list').load("http://www.example.com/images/test.html ul");
});
</script>
</head>

<body>
<div id="list"></div>

</body>
</html>


and here is the source page code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div id="list">
<ul>
<li><a href="http://www.example.com">link1</a></li>
<li><a href="http://www.example.com">link2</a></li>
</ul>
</div>
</body>
</html>


Does anybody with expert eyes see why this isn't working?

Thank you so much!

[edited by: Fotiman at 4:14 pm (utc) on Mar 4, 2010]
[edit reason] Examplified URLs [/edit]

Fotiman

4:20 pm on Mar 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are both pages in the same domain? If not, then your AJAX won't work because of the same origin policy. This is a security feature of the browser.

bhansel

4:57 pm on Mar 4, 2010 (gmt 0)

10+ Year Member



ok...yes...both files are on same domain...js isn't

Fotiman

5:35 pm on Mar 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In that case, I don't see anything obvious. I would try adding some breakpoints in Firebug to see what is happening and use the Net panel in Firebug to see if the requested file is being fetched.

bhansel

5:43 pm on Mar 4, 2010 (gmt 0)

10+ Year Member



thanks!