2010-08-31 102 views
0

我在我的web应用程序中使用jquery的加载插件。ie8兼容模式中的jquery加载问题

这里是我的一段代码:

$.post("/ecommerceV2/"+langcode+"/ecommerce/sortPromo",{promotypeid: $(v).val()},function(response){ 
    if (response.same == 'yes'){ 
    $('#infoLegende').show(); 
    $('#infoLegende').html('no' + $('#legende'+$(v).val()).html()); 
    }else{ 
    $('#infoLegende').hide(); 
    $('#legende'+$(v).val()).addClass('legendeBackground'); 
    $('#legende'+$(v).val()).removeClass('legendeTest'); 
    $('.assortiment').fadeOut('slow'); 
    $('.assortiment').load("/ecommerceV2/"+langcode+"/ecommerce/volledigAssortiment .assortiment",{assortiments: response.assortiments},function(){ $('.assortiment').fadeIn('slow'); 
    } 
},"json"); 

.assortiment是一个表。 这段代码在ie8,firefox,chrome中工作正常......只有ie8的相容性模式不会在我的表中显示结果。

有人可以帮助我吗?

更新:

<div id="lijst"> 
    <div id='assortimentHeader'></div> 
<table summary='assortiment' class='assortiment' width=805 id='assortiment' cellspacing=0> 
<tr id='headerAssortiment' > 
<th width=20 style='text-align: center;'>Code</th> 
<th width=200 style='text-align: center;'>Omschrijving</th> 
<th width=40 style='text-align: right;'>Prijs</th> 
<th width=40 style='text-align: right;'>Adv.prijs</th> 
<th width=35 style='text-align: right;'>Marge</th> 
<th width=20 style='text-align: center;'>Bestel</th> 
<th width=6 style='text-align: center;'>B1</th> 
<th width=6 style='text-align: center;'>B2</th> 
<th width=6 style='text-align: center;'>B3</th> 
</tr> 
<tr class='artikelgroep'><td colspan='9'><img alt='add' src='/ecommerceV2/assets/images/icons/add%202.png' style='float:left;' /><b>CHAMPIGNONS</b></td></tr> 
<tr align='center' class="artikelRijDonkerPromo1"> 
<td width=20>5905</td> 
<td width=200 class='omschrijving' style='cursor: pointer; text-align: left;'>CHAMP. (12X250GR)DEKSEL<img alt='foto' src='/ecommerceV2/assets/images/camera.png' style='float: right;' width='25' height='17' /><input type='hidden' class='artikel' value='5905' /></td> 
<td width=40 style='text-align: right;'>&euro; 0.73</td> 
<td width=40 style='text-align: right;'>&euro; 1.19</td> 
<td style='margin-left: 20px; text-align: right;' width=35>34.97%</td> 
<td width=20><input type='text' style='text-align: right; border: 1px #d9d9d9 solid;' size=5 class='aantal' name='aantal[5905]' /><input type='hidden' class='artikel' value='5905' /></td> 
<td width=6>1</td> 
<td width=6></td> 
<td width=6>1</td> 
</tr> 
</table> 
</div> 
+0

我不得不问,为什么你使用IE 8的“兼容性”模式? – 2010-08-31 14:03:07

+0

我的web应用程序必须在ie8,ie7,...中运行并且因为ie8兼容性模式模拟我使用它的ie7行为。 – 2010-08-31 14:08:45

+2

IE8兼容模式!== IE7。 – ajm 2010-08-31 14:19:15

回答

0

任何错误,你能告诉我们吗?

首先,您可能会忽略.load函数的右括号吗?我改变了你的代码,并且说明了我的工作方式,更容易看到方括号等(我发现)。这是我最后的结果,括号现在匹配。虽然如果这是这个问题,我很惊讶它可以在任何浏览器中使用。

$.post("/ecommerceV2/"+langcode+"/ecommerce/sortPromo",{promotypeid: $(v).val()},function(response) 
{ 
    if (response.same == 'yes') 
    { 
     $('#infoLegende').show(); 
     $('#infoLegende').html('no' + $('#legende'+$(v).val()).html()); 
    } 
    else 
    { 
     $('#infoLegende').hide(); 
     $('#legende'+$(v).val()).addClass('legendeBackground'); 
     $('#legende'+$(v).val()).removeClass('legendeTest'); 
     $('.assortiment').fadeOut('slow'); 
     $('.assortiment').load("/ecommerceV2/"+langcode+"/ecommerce/volledigAssortiment .assortiment", {assortiments: response.assortiments} , function() 
     { 
      $('.assortiment').fadeIn('slow'); 
     }); 
    } 
} ,"json"); 
+0

感谢您的回答jakenoble,但这是一个错字。你的代码与我的代码完全一样,它在ie7中仍然没有做任何事情。 – 2010-08-31 14:16:01

+0

你能向我们展示Jurgen Vandw的错误吗? – 2010-08-31 14:17:42

+0

这就是问题所在。我没有错误。 :s 在firefox中,chrome,ie8,...我得到我的表,在ie7中我的表不会显示出来。我已经为ie下载了debugbar,并且检查了js返回的结果,它返回了我的结果,但是它没有出现在表格中。可能是一个CSS错误,但我运行了一个验证器,它给了我没有错误。 – 2010-08-31 14:20:39

1

尽管我建议修复代码,但是解决方法是确保页面在默认情况下不会以IE8兼容模式呈现。你可以在你的网页的头部做到这一点:

<head><meta http-equiv="X-UA-Compatible" content="IE=8" /></head> 
+0

谢谢我现在已经这样做了,但这并不能解决我的问题ie ie 7 – 2010-08-31 14:53:06