javascript 如何使用 jquery 在带有“POST”的新选项卡中进行重定向?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19020420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to do Redirection in a new tab with 'POST' using jquery?
提问by Satheesh
Any how I managed to find a jquery plugin which redirects with 'POST'. But It's getting open in same window. I want it in a new tab. Please help me out guys.
我如何设法找到一个使用“POST”重定向的 jquery 插件。但它在同一个窗口中打开。我想要它在一个新标签中。请帮帮我吧伙计们。
Here is my code of jquery which redirects
这是我重定向的 jquery 代码
$().redirect('DLE_Report.php', {'Partner_Id': Partner_Id, 'Project_Id': Project_Id, 'Proposal_Id': Proposal_Id, 'Version_Id': Version_Id});
I used jquery.redirect.min.jsplugin for redirection.
我使用jquery.redirect.min.js插件进行重定向。
Please Remember, I want to redirect with 'POST' method. Every one here answered for GET method.
请记住,我想用“POST”方法重定向。这里的每个人都回答了 GET 方法。
回答by Moeed Farooqui
You need to open url
in a new tab using window.open()
function.
您需要url
使用window.open()
功能在新选项卡中打开。
Js:
JS:
function OpenInNewTab(url )
{
var win=window.open("http://www.google.com", '_blank');
win.focus();
}
Html:
网址:
<div onclick="OpenInNewTab();">Something To Click On</div>
回答by Moeed Farooqui
this code helpful for you.
<a href="http://www.google.com" target="_newtab">click</a>
回答by Developerium
You mean you want to open in a new tab, not redirect. Or it wouldn't mean redirect!
您的意思是要在新选项卡中打开,而不是重定向。或者这不意味着重定向!
http://forum.jquery.com/topic/open-link-in-new-tab-with-click
http://forum.jquery.com/topic/open-link-in-new-tab-with-click