单击文本后提交隐藏表单一次
我有一组成员作为我们的合作伙伴存储了其他网站的登录凭据(usr | pwd)。根据情况,我应该只向他们提供一个文本链接,并在单击该链接后提交一份表格。
// Getting values from db and storing them in javascript variables
<script type="text/javascript">
// values from db stored in javascript variables
var at_Cara = "<? echo $at;?>";
var ln_Cara = "<? echo $ln;?>";
var wd_Cara = "<? echo $pw;?>";
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
// I am submitting a form with hidden values, which is as follows:
$(document).ready(function() {
$("#goto").click(function() {
var site = "http://franka.finexp.net/login.aspx";
$('<input>').attr({type: 'hidden',id: 'Auto',name: 'Auto',value: at_Cara}).appendTo('#valgoogexp');
$('<input>').attr({type: 'hidden',id: 'LoginName',name: 'LoginName',value: do_ln_Cara}).appendTo('#valgoogexp');
$('<input>').attr({type: 'hidden',id: 'Password',name: 'Password',value: wd_Cara}).appendTo('#valgoogexp');
$("#valgoogexp").attr("action", site);
$("#valgoogexp").submit();
});
return false;
});
</script>
<a href="javascript:void(0);" id="goto" >Research Tool</a>
<form id="valgoogexp"></form>
问题是单击链接后表单会提交两次。随后登陆页面显示这是一个字符串错误。
I have a set of members who have stored their login credentials (usr | pwd) of other websites as our partners. As is the situation, I am supposed to provide them just a text link and submit a form upon clicking that link.
// Getting values from db and storing them in javascript variables
<script type="text/javascript">
// values from db stored in javascript variables
var at_Cara = "<? echo $at;?>";
var ln_Cara = "<? echo $ln;?>";
var wd_Cara = "<? echo $pw;?>";
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
// I am submitting a form with hidden values, which is as follows:
$(document).ready(function() {
$("#goto").click(function() {
var site = "http://franka.finexp.net/login.aspx";
$('<input>').attr({type: 'hidden',id: 'Auto',name: 'Auto',value: at_Cara}).appendTo('#valgoogexp');
$('<input>').attr({type: 'hidden',id: 'LoginName',name: 'LoginName',value: do_ln_Cara}).appendTo('#valgoogexp');
$('<input>').attr({type: 'hidden',id: 'Password',name: 'Password',value: wd_Cara}).appendTo('#valgoogexp');
$("#valgoogexp").attr("action", site);
$("#valgoogexp").submit();
});
return false;
});
</script>
<a href="javascript:void(0);" id="goto" >Research Tool</a>
<form id="valgoogexp"></form>
The problem is that the form submits twice upon clicking the link. And subsequently the landing page says its a string error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论