javascript - 从网站提交另一个网站提交按钮

标签 javascript jquery asp.net

我想使用 javascript 从我的网站提交另一个网站提交按钮,这可能吗..?我的代码如下:

<script type="text/javascript">
    function formSubmit() {
        document.getElementById("form1").submit();
    }
</script>

<form name="form1" method="post" action="http://XXXXX/Login.aspx?ReturnUrl=%2fdefault.aspx?" id="form1" >
    <input type="hidden" name="NewCorporateId" id="NewCorporateId" value="XX" />
        <input type="hidden" name="UserName" id="UserName" value="XXXX" />
        <input type="hidden" name="Password" id="Password" value="XXXX"  />
</form>

<form name="form2" id="form2" method="post> 

 <a href ="javascript:formSubmit()">Click here</a>

</form>

最佳答案

Specified URL opened fine in new tab and button not submitted in that site. That site contain the one submit button and username and password text filed.. I have username and password value.. So i try to submit the button in referring site from my website.

有可能,邮政代码是正确的但是因为您在 aspx 页面上发布 Login.aspx,aspx 页面会防止发送数据即不是来自同一站点并添加了哈希代码的控件。还有页面的 ViewState 以及 aspx 添加的其他隐藏参数 - 因此您的调用将失败

与处理 login.aspx 页面的人员联系,为您提供某种登录方式 - 而不是直接通过页面登录。

相关: What is the purpose of __EVENTVALIDATION __VIEWSTATE in aspx?

关于javascript - 从网站提交另一个网站提交按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37805512/

相关文章:

javascript - 安全地拆分表情符号

javascript - 作为类的函数 - 为私有(private)属性创建 getter 和 setter

jquery - 检测单个或多个文件拖动

c# - 在 UpdatePanel 中使用 GridView

c# - 如何使用asp.net c#根据用户输入查询oracle数据库

javascript - ScrollTop 的 Shopify javascript/jQuery 条件不起作用

javascript - 如何覆盖库的属性? (colResizable.js)

javascript - jQuery ajax 完成在 WordPress 上总是失败

jquery - 将 li 添加到 ul 的中间(jquery)

c# - 尝试使用 <list> 将对象放入数组时无法从 void 转换为模型