不工作的IE浏览器和Opera Ajax请求浏览器、工作、Ajax、IE

由网友(志在飞翔)分享简介:由于某种原因而使用Ajax请求我没有得到回应。它不会在互联网上exploer和Opera的工作。它适用于Firefox和Chrome浏览器。这里是code:For some reason I don't get response while using ajax requests. It doesn't work o...

由于某种原因而使用Ajax请求我没有得到回应。它不会在互联网上exploer和Opera的工作。它适用于Firefox和Chrome浏览器。这里是code:

For some reason I don't get response while using ajax requests. It doesn't work on Internet exploer and Opera. It works on Firefox and Chrome. Here is the code:

$(document).ready(function() {
    $("#registration").submit(function (e) {
        e.preventDefault();
        var str = $(this).serialize();
        $.ajax({
            type: "POST",
            url: "/ajax.php",
            data: str,
            success: function (msg) {
            alert(msg);
            }
        });
    });
});

我添加 AddDefaultCharset UTF-8 的.htaccess 文件,但我仍然没有得到它的工作在IE浏览器和Opera。

I added AddDefaultCharset utf-8 to .htaccess file but I still don't get it to work on IE and Opera.

这可能是什么问题?

推荐答案

在过去,我面临着同样的问题。有什么解决的是通过将阿贾克斯呼叫一个变种。

In the past I faced the same issue. What solved it is by putting the .ajax call on a var.

var callAjax =   function(){
$.ajax({
        type: "POST",
        url: "/ajax.php",
        data: str,
        success: function (msg) {
        alert(msg);
        }

};

也可以尝试把下面的jQuery的Click事件之外。 (全球)

Also try putting the following outside the jquery Click event. (Global)

var str = $(this).serialize();

我希望这有助于。

I hope this helps.

阅读全文

相关推荐

最新文章