Problem: why does location.reload not work unless there is an alert call right before the statement?
background on my page: a lot of extensive code that i don't want to make you sort through...ultimately, the page loads a table of work queue items. at the top is are drop down list boxes to filter the data. i'm wanting the onChange of the ddl's to refresh the page (individually) appending variable=xyz to the URL. that variable is used in the sql select to reduce/change the result set to display as work queue items.
the weird thing: it works as long as i have an alert statement between setting location.href and location.reload. if i comment out the alert statement it no longer works. why? i don't want to annoy the user poping up a box..."I'm gonna refresh your data".
anyone have any ideas?
background on my page: a lot of extensive code that i don't want to make you sort through...ultimately, the page loads a table of work queue items. at the top is are drop down list boxes to filter the data. i'm wanting the onChange of the ddl's to refresh the page (individually) appending variable=xyz to the URL. that variable is used in the sql select to reduce/change the result set to display as work queue items.
the weird thing: it works as long as i have an alert statement between setting location.href and location.reload. if i comment out the alert statement it no longer works. why? i don't want to annoy the user poping up a box..."I'm gonna refresh your data".
anyone have any ideas?
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>
<head>
</head>
<body>
just an example page...
<input type="text" id="myField" onChange="refreshPage();">
<script type="text/javascript">
function refreshPage(){
newLoc = parent.document.URL + "?variable="+document.getElementById("myField").value;
document.location.href = newLoc;
alert("hello world!");
document.location.reload(true);
}
</script>
</body>
</html>