2013-01-22 85 views
0

下面的代碼工作正常在FF,歌劇和鉻,但在IE笨AJAX的Internet Explorer

失敗
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); 
      } 
     }) 
    } 

無法理解的問題。

+0

每當我有一個問題,從IE瀏覽器從AJAX調用返回HTML時,我首先檢查,看看HTML是否有效。如果您忘記關閉標籤或其他東西,IE並不是那麼寬容。 – swatkins

+0

從代碼中移除console.log行....此行停止在ie中執行其他行 –

回答

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"); 
     } 
    });