ajax未在外部div下加载
我有外部html,在这里我创建了通过ajax加载的jcorousal图像。但该外部页面未加载到我当前的div中:ajax未在外部div下加载,ajax,Ajax,我有外部html,在这里我创建了通过ajax加载的jcorousal图像。但该外部页面未加载到我当前的div中: <div class="corousal_content" id="MyDivName"> <!-- External html will load here--> </div> 这是我的外部页面,由jCarous组成: <script type="text/javascript"> alert("load ajax"); funct
<div class="corousal_content" id="MyDivName"> <!-- External html will load here--> </div>
这是我的外部页面,由jCarous组成:
<script type="text/javascript">
alert("load ajax");
function mycarousel_itemLoadCallback(carousel, state)
{
// Since we get all URLs in one file, we simply add all items
// at once and set the size accordingly.
if (state != 'init')
return;
jQuery.get('dynamic_ajax.txt', function(data) {
mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, data);
});
};
function mycarousel_itemAddCallback(carousel, first, last, data)
{
// Simply add all items at once and set the size accordingly.
var items = data.split('|');
for (i = 0; i < items.length; i++) {
carousel.add(i+1, mycarousel_getItemHTML(items[i]));
}
carousel.size(items.length);
};
/**
* Item html creation helper.
*/
function mycarousel_getItemHTML(url)
{
return '<img src="' + url + '" width="75" height="75" alt="" />';
};
jQuery(document).ready(function() {
jQuery('#mycarousel').jcarousel({
itemLoadCallback: mycarousel_itemLoadCallback
});
});
</script>
</head>
<body>
<div id="wrap">
<div id="mycarousel" class="jcarousel-skin-ie7">
<ul>
<!-- The content will be dynamically loaded in here -->
</ul>
</div>
</div>
请解决我的问题….如何加载外部html? 因为,我认为它未能在外部html上触发jQuery.ready事件