0

the following code works fine in FF, opera and chrome but fails in IE

function get_modelo(modelo) {
        var selState = modelo;
        alert (selState);
        console.log(selState);
        $.ajax({    
            url: "site/ajax_call", //The url where the server req would we made.
            async: false, 
            type: "POST", //The type which you want to use: GET/POST
            data: "state="+selState, //The variables which are going.
            dataType: "HTML", //Return data type (what we expect).

            //This is the function which will be called if ajax call is successful.
            success: function(data) {
                //data is the html of the page where the request is made.
                $('#city').html(data);
            }
        })
    }

Can't understand the problem.

4

2 回答 2

3

IE 中的 console.log 不起作用或导致问题。

请参阅此处: IE8 中的 console.log 发生了什么?

在这里: 在 IE 中测试 console.log 语句

在这里: http: //paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/

或者只是谷歌搜索IE控制台日志

您代码中的其他所有内容看起来都可以正常工作。

于 2013-01-22T01:33:41.023 回答
0

尝试这个。下面将在 IE8 中工作:P

$.ajax({    
        url: "site/ajax_call", //The url where the server req would we made.
        async: false, 
        type: "POST", //The type which you want to use: GET/POST
        data: { state: selState }, //The variables which are going.
        dataType: "html", //Return data type (what we expect).

        //This is the function which will be called if ajax call is successful.
        success: function(data) {
            var newDiv = $('<div></div>');
            newDiv.html(data);
            newDiv.appendTo("#city");
        }
    });
于 2013-01-22T06:17:11.200 回答