2012-12-12 41 views
0

我有这样的代码工作..重定向网页不能在IE

jQuery('#button_search').click(function(event){ 
    event.preventDefault(); 

    var propertyUrl = getBaseURL()+'public/Property/view-property'; 
    var locationUrl = getBaseURL()+'public/Property/view-location'; 

    if($('#propl').is(':checked')) 
    { 

     var selectedLoc = jQuery('#select_location').val(); 

     if(selectedLoc == 'default'){ 
      alert('Please Select Location'); 
     }else{ 
      $().redirect(locationUrl, {'arg1': 'value1', 'arg2': 'value2'}); 
     } 

    } 
    else if($('#propn').is(':checked')) 
    { 

     var selectedProp = jQuery('#select_properties').val(); 

     if(selectedProp == 'default'){ 
      alert('Please Select Property'); 
     }else{ 
      $().redirect(propertyUrl, {'propertyId': selectedProp}); 
     } 
    } 
    else{ 
     alert('Select property or location'); 
    } 

}); 

我使用自定义的按钮,我点击了event..when的持有人按钮后,我选择某一个项目它应该重定向到其他页面..它在Firefox,Chrome和Opera中运行良好,但它在IE中不起作用。可能是什么问题呢?

回答

0

从你的问题中不清楚IE除了重定向之外还在做什么,但是如果你把这个按钮放在表单中,那么我的猜测是表单正在提交。你应该在你的点击处理程序的末尾加入return false,以确保没有发生点击按钮(提交表单)的默认操作。否则,某些浏览器可能会执行表单提交,导致重定向不再发生。

+0

感谢您的回复..我使用zend框架..该按钮应该把用户带到其他页面对应于用户搜索请求..使用jquery.redirect.js我的重定向功能,因为我需要放置一个参数来过滤结果..它可以在除IE以外的其他浏览器中使用。该按钮在IE中不起作用。 – cfz