I want to display alert message and then refresh the page.
But it take infinite loop of alert messages.
if(isValid){
alert("alert some text");
document.location.reload(true);
}
else {
.............
}
How can I do that with out infinite loop
You would have to pass along the state. Possibly refreshing the page by pointing itself with a querystring variable. Then read that variable
Note the
getParameterByNamefunction is found at another stackoverflow answer: How can I get query string values in JavaScript?. You could alternatively use a library such as jQuery for a better solution.