Reputation: 5801
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
body{ font-size: 12px; font-family: Arial; }
</style>
<script type="application/javascript" src="jquery-1.4.2.min.js"></script>
</head>
<body>
<b>Footer navigation:</b>
<div id="new-nav"></div>
<div id="new-nav1"></div>
<script type="application/javascript">
jQuery(document).ready(function(){
$("#new-nav").load("test/index1.php");
$("#new-nav").ajaxStop(function(){
$("#new-nav1").load("test/index1.php")
});
});
</script>
</body>
</html>
I want to use jQuery load
to part load my two PHP pages into my main page, but it works in Firefox, not in IE - where is the problem?
Upvotes: 0
Views: 178
Reputation: 1075885
Two problems:
type
Your type
is wrong:
<script type="application/javascript">
Live example (not working in IE)
It should be:
<script type="text/javascript">
...or you can just leave it off, as all major browsers (and probably all minor ones) default to JavaScript, and the latest standard-in-progress reflects this by making JavaScript officially the default.
Live example (working in IE)
That may may well create an infinite loop, because the second load
call will trigger your ajaxStop
handler when it completes, causing another load
, causing another ajaxStop
, etc.
Instead, try:
jQuery(function($){
$.ajax({
url: "http://jsbin.com/esili3",
success: function(data) {
$("#new-nav").html(data);
$("#new-nav1").load("http://jsbin.com/ixiko5");
}
});
});
Upvotes: 7