window.location() not working, not opening page
Try using replace
function instead
window.location.replace('http://www.rainbowcode.net/index.php/profiles/mail?='+mailid)
I spent 2 days trying every solution shown here and elsewhere, to no avail. Then I removed the form
tags, which served no purpose since there was no submit
button, and the problem went away using:
window.location = 'mypage.php', true;
If you need to open a new window, you should use the window.open() method. window.location refers to the current windows address, and will only - when using window.location.reload()
- reload the CURRENT window.
Setting the location works just fine, but then the form is submitted, which will reload the current page instead.
Return false from the method:
function sendmail() {
window.location.href = "http://www.rainbowcode.net/index.php/profiles/mail?="+mailid;
return false;
}
and return that status in the event to stop the submit:
<input type="submit" value="Send" onclick="return sendmail()">