When user submit the form, it take alot of time to load because sending emails after pressing submit button. I want after submitting browser automatically open another tab for user to use. i tried below code but does not work.
echo "<script>window.open('Cust_ledger.php?id=$required_name')</script>";
I'm considering that, you want to open URL in new tab when you Submits a form,
Try this JQuery code, myForm
is an ID of your form
$("#myForm").submit(function(){
window.open('Cust_ledger.php?id=$required_name', '_blank');
});
You will do something like this:
Online DEMO .
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<a id="your_link" href="http://www.google.at" target="_blank">New Tab</a>
</body>
</html>
JS:
$(document).ready(function(){
window.setTimeout(function(){
var yourLink = document.getElementById("your_link").href;
var newOpenTab = window.open(yourLink, '_blank');
}, 5000);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.