jQuery的/ Ajax调用 - 它不IE7工作 [英] jQuery/Ajax call - It Doesn't work on IE7

查看:124
本文介绍了jQuery的/ Ajax调用 - 它不IE7工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做一个jQuery的功能(暂时)调用一个函数dinamically和警报打印。与Firefox,Chrome浏览器:它的工作原理!当我尝试在IE7(第一次),它失败。如果我重新载入页面(F5),然后重试,它的作品! O_O

i make a Jquery function that (for the moment) call a function dinamically and print it with an alert. with firefox, chrome : it works! when i try on IE7 (the first time), it fails. If i reload the page (F5) and retry , it works! o_O

我终于明白为什么这会发生。在我的旧网站,我用了jQuery-1.3.2.min.js库。在这方面,我使用了jQuery-1.4.2.js而事实上它不工作。那么这是什么一回事?在这个新版本中的一个错误?

I FINALLY understand why that's happen. In my old website i used the jquery-1.3.2.min.js library. On this i use the jquery-1.4.2.js and in fact it doesnt work. So what's up? A bug in this new version?

欢呼声

实际功能(与布赖恩·沃特斯建议):

actual functions (with Bryan Waters suggestions):

// html page
<a href="#" onClick="pmNew('1');return false">prova</a>    

// javascript page
function pmNew(mexid) {
    var time = new Date;
    $.ajax({
        type: 'POST',
        cache: false,
        url: './asynch/asynchf.php' + '?dummy=' + time.getTime(),
        data: 'mexid='+escape(mexid)+'&id=pmnew',
        success: function(msg) {
            alert(msg);
        }
    });
    return false;
}

// ajax.php
if($_POST['id']=="pmnew") {
    echo "please, i will just print this";
}

提琴手结果:如果我使用的http://本地主机/网站小提琴手犯规捕捉流。如果我使用 HTTP://ipv4.fiddler/website 它捕捉流,但在Ajax请求犯规appair。如果我刷新页面,是的,它的工作原理。麻将...我真的不知道如何解决这个问题?

Fiddler result : if i use http://localhost/website fiddler doesnt capture the stream. if i use http://ipv4.fiddler/website it capture the stream, but at the ajax request doesnt appair. if i refresh the page, yes it works. mah...i really don't know how resolve this problem...

推荐答案

最好的调试方法是下载小提琴手,看看HTML流量是怎么回事,如果浏览器甚至使Ajax请求,什么结果200或404或什么的。

Best way to debug is to download Fiddler and see what the HTML traffic is going on and if the browser is even making the ajax request and what the result is 200 or 404 or whatever.

我有问题,IE浏览器cacheing甚至在帖子。甚至不会发出请求。我通常创建一个Date对象在JavaScript中,添加一个虚拟时间戳只是为了让URL唯一的,这样就不会被缓存。

I've had problems with IE cacheing even on posts. And not even sending out the requests. I usually create a date object in javascript and add a dummy timestamp just to make the url unique so it won't be cached.

这篇关于jQuery的/ Ajax调用 - 它不IE7工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆