重定向页面在IE中不起作用

时间:2012-12-12 01:16:53

标签: jquery redirect

我有这段代码..

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

});

我使用了一个自定义按钮作为事件的持有者..当我选择某个项目之后我点击该按钮它应该重定向到另一个页面..它在Firefox,Chrome和Opera中运行良好但它没有在IE工作。可能是什么问题?

1 个答案:

答案 0 :(得分:0)

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