Ajax的jQuery不适用于IE

编程入门 行业动态 更新时间:2024-10-28 14:36:45
本文介绍了Ajax的jQuery不适用于IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好.我使用的js/ajax脚本不适用于Internet Explorer. Firefox可以.

Hey guys. I'm usign a js/ajax script that doesnt work with internet explorer. Firefox its ok.

head标签,我正在使用它:

Btw the head tag, im using this:

$(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: "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代码,例如:

The loader.php contain the php code to get pages, something like:

switch($_GET['page']) { case '#link1' : $page = 'contenthere'; break; } echo $page;

因此,在链接上,我正在使用链接1将内容加载到div内容中.

So, on the links, i'm using Link 1 to load the content into the div content.

该脚本在firefox上运行良好,但在Internet Explorer中不会加载内容.有人可以帮我解决这个问题吗?

The script does works well with firefox, but with internet explorer it doesnt load the content. Could someone pls help me to fix this?

它根本没有进入IE上的成功功能,而且我也没有从IE中收到html错误.

It not go into the success function at all on IE, and i'm getting no html error from IE too.

最好的问候.

推荐答案

确保您的html声音正确. FF倾向于自动修复语法.

Make sure your html is sounds. FF tends to auto fix the syntax.

更多推荐

Ajax的jQuery不适用于IE

本文发布于:2023-11-24 21:38:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626939.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   Ajax   jQuery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!