0

I'm having trouble with the following code in Firefox and Safari. The page is listing items and this code is allowing the user to filter the results. So the user chooses their filter items and then hits the GO button and the frame with the results should reload with only the items that were filtered on. The frame is loaded through a separate ASP page that the one this code is in.

This works fine in Internet Explorer but not in Firefox or Safari - nothing happens. I have run Firebug and the parameters are getting generated correctly in the if statements. It just seems like the reload never happens. When I run that separate frame/ASP by itself and put the parameters in by hand with the URL, it works fine in Firefox. So it seems to be something with the reload statement. What am I doing wrong?

function Reloadit() {
    var params = "";
    if (Payload.value != "") {
        params +=('Payload='+Payload.value)+'&'
    }
    if (Status.value != "") {
        params +=('Status='+Status.value+'&')
    }
    if (Assignee.value != "") {
        params +=('Assignee='+Assignee.value+'&')
    }
    if (SearchWord.value != "") {
        params += 'SearchWord='+SearchWord.value+'&SearchField='+SearchField.value+'&'
    }
    window.parent.frames["list"].location.reload('PAILReports.asp?'+params);
}

<input type="button" style="MARGIN-TOP:6px" value="GO" onclick="Reloadit(true);">
1
  • 1
    Better you should have post this question in Stack Overflow. May 14, 2012 at 17:22

1 Answer 1

0

IE is at fault here, since your code shouldn't have worked in the first place.

Here is what window.location.reload(forceget) is supposed to do:

Reload the document from the current URL. forceget is a boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.

Source: window.location - MDN # Methods

As you can see, the argument for reload() should not get interpreted as an URL.

To open a different page, you can use the following command:

window.parent.frames["list"].location = 'PAILReports.asp?'+params;
1
  • Thanks! That worked for the first two parameters. I probably need to do some more fixes for the searchword parameter, since it is still not working. But this is very helpful to get me there.
    – Becky G
    May 14, 2012 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.