I'm validating a form and after validation, I want to redirect with window.location = xxx but it doesn't work unless I put an alert call after it.
The validation works by handling the onsubmit event of the form.
function isvalid()
{
var txt = document.getElementById('txtTitle');
if (txt.value == '')
{ alert('Please enter a title'); return false;}
else
{
var sURL = "get_movies.php?title=" + txt
window.location.href = sURL;
//alert('');
return true;
}
}