0
嘿家伙。我正在使用一个不适用于Internet Explorer的js/ajax脚本。 Firefox的确定。ajax jquery does not work on ie
顺便说一下头标记,使用该即时通讯:
$(document).ready(function() {
//Check if url hash value exists (for bookmark)
$.history.init(pageload);
//highlight the selected link
$('a[href=' + document.location.hash + ']').addClass('selected');
//Seearch for link with REL set to ajax
$('a[rel=ajax]').click(function() {
//grab the full url
var hash = this.href;
//remove the # value
hash = hash.replace(/^.*#/, '');
//for back button
$.history.load(hash);
//clear the selected class and add the class class to the selected link
$('a[rel=ajax]').removeClass('selected');
$(this).addClass('selected');
//hide the content and show the progress bar
$('#content').hide();
$('#loading').show();
//run the ajax
getPage();
//cancel the anchor tag behaviour
return false;
});
});
function pageload(hash) {
//if hash value exists, run the ajax
if (hash) getPage();
}
function getPage() {
//generate the parameter for the php script
var data = 'page=' + encodeURIComponent(document.location.hash);
$.ajax({
url: "http://pathfofolder/js/loader.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
//hide the progress bar
$('#loading').hide();
//add the content retrieved from ajax and put it in the #content div
$('#content').html(html);
//display the body with fadeIn transition
$('#content').fadeIn('slow');
}
});
}
的loader.php包含PHP代码得到页,是这样的:
switch($_GET['page']) {
case '#link1' : $page = 'contenthere'; break;
}
echo $page;
所以上的链接,我m使用链接1将内容加载到div内容中。
该脚本的确适用于firefox,但与Internet Explorer不会加载内容。有人可以帮我解决这个问题吗?
它并没有进入IE的成功功能,我也没有从IE获得HTML错误。
最好的问候。
你在IE中收到javascript错误吗?当你提醒退货内容是否正确时,或者根本没有进入成功功能? – 2011-02-25 17:40:31
根本不进入坦途的成功功能。 – Ricardo 2011-02-25 18:06:52
因为您尚未注册,所以只要您的浏览器cookie被删除,您就会失去对您帐户的控制权。只要Cookie处于活动状态,您就可以编辑您的问题并对此页面上的任何帖子发表评论。 – 2011-02-25 18:17:42