单击文本后提交隐藏表单一次

发布于 2024-12-07 15:44:34 字数 1517 浏览 0 评论 0原文

我有一组成员作为我们的合作伙伴存储了其他网站的登录凭据(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文