2012-10-10 27 views
0

我有合作,並且這是通過以下方式jQuery文檔(html_content)功能似乎並不在IE7

var new_options = { 
      dataType: 'json', 
      beforeSubmit: function() { 
       alert('inside before submit'); 
       $(".available_script_arguments").each(function(index) { 
       argument_id = $(this).val() 
       $("td#argument_"+argument_id).addClass("resource_automation_loader"); 
       });     
      }, 
      success: function(data) { 
       alert('inside success'); 
       $(".available_script_arguments").each(function(index) {      
       argument_id = $(this).val() 
       $("td#argument_"+argument_id).removeClass("resource_automation_loader"); 
       $("td#argument_"+argument_id).html(data[argument_id]).html(); 
       $("td#argument_"+argument_id).html("<span></span>"); 
       updateTargetArgumentId(); 
       triggerAdapterResourceAutomation(); 
       }); 
      }, 
      error: function(jqXHR, textStatus, errorThrown){ 
       alert('inside error'); 
      $(".resource_automation_loader").each(function(){ 
       // This will hide the loader 
       $(this).removeClass("resource_automation_loader"); 
       // This will display text N.A indicating the resource automation has failed 
       $(this).html("<input type='text' value='' placeholder='N.A'></input>"); 
      }); 
      } 
      }; 
      $("form#update_resource_automation_parameters").ajaxSubmit(new_options); 

該功能定義ajaxSubmit的方法是在Firefox工作正確,但在IE7中不工作。

我找到了原因,它出來與成功回調中使用jQuery的HTML函數。

作爲成功回調數據即將作爲HTML(的DIV組合並選擇)

在成功回調(以下給出)

<div > 
<select arg_val="null"> 
<option value="">Select</option> 
<option value="0">Corporate Strategic</option> 
<option value="1">Business Unit Strategic</option> 
<option value="2">Maintenance</option> 
<option value="3">Defect</option> 
</select> 
</div> 

所以這個數據基本上輸出到選擇inspecing數據之後列表中的視圖,但這不適用於IE7。

讓我知道是否有人對此有任何想法。

謝謝, 院長。

回答

0

嘗試使用append代替html

+0

已嘗試使用append和appendTo但沒有運氣 –

0

進一步的拉胡爾來的回答你不斷通過jQuery的選擇相同的對象。 當您在JQuery中執行操作時,它將返回受影響的對象,允許您鏈接您的操作。

例如:

$("td#argument_"+argument_id).removeClass("resource_automation_loader"); 
$("td#argument_"+argument_id).html(data[argument_id]).html(); 
$("td#argument_"+argument_id).html("<span></span>"); 

可以成爲:

$("td#argument_"+argument_id).removeClass("resource_automation_loader") 
          .append(data[argument_id]) 
          .append("<span></span>"); 

其中僅選擇對象一次。

+0

感謝您提供此解決方案,但不幸的是,這在IE7中也不起作用 –