Firefox中的location.href

In my jQuery Ajax script, I wrote

$.ajax({
            url: SearchUrl,
            type: 'POST',
            data: submitData,
            dataType: 'json',
success: function (rec) {
                if (rec.data) {
                    if (rec.data.url) {
                        pageLoading();
                        location.href = rec.data.url;
                    }
                    if (rec.data.error) {
                        errorText.text(rec.data.error);
                    }
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                location.href = refreshUrl;
            }
        });

The thing is that there does have rec.data.url in the return data from the controller. The code works well to redirect to the url given in rec.data.url when I tested on IE, Safari, Chrome.However this didn't work in Firefox 10.1, only the current page is reloaded but not any redirection. if I put an alert("") between pageLoading() and location.href = rec.data.url, Firefox will redirect to the url in rec.data.url after the alert message.

try this

window.location = 'your url';

somehow I guess in FF and few other browsers window.location.href is readonly property, thus it fails but just using location should be ok