我希望能够自动提交表单(通用表单,供用户跟踪)。如何使用javascript自动提交表单(onevent)?
例如,创建一个POST到 http://www.example.com/index.php?option=track&variable=variable 应用程序/ x-WWW窗体-urlencoded有东西像
username=usernamestring
otherdata=otherdata_string
otherdata2=otherdata string 2
实际字符串将预先格式化,不过,因为所有它就像一个'平”。 它需要提交onevent,与外部js(http://example.com/scripts/js.js)
我应该干什么?这变得很烦人。
更新:我想我并没有真正说清楚;我有一个不应该在页面上显示的预制表单;它需要提交一个事件。表单域不存在于页面上;我所做的只是链接到页面上的脚本,并执行onLoad。
POST uri:http://www.example.com/index.php?option=track&variable=variable 上面的参数(option = track和variable = variable)不是表单详细信息(postdata)。
内容类型为application/x-www-form-urlencoded,并具有以下键/值。
username=usernamestring
otherdata=otherdata_string
otherdata2=otherdata string 2 (when encoded, the spaces get turned to %20's.)
我需要一个脚本,在运行时提交此脚本。
谢谢,希望我早点被告知。虽然有时候并不总能得到足够的答案,但我通常会很好。 – 2012-01-15 15:40:13
请参阅http://stackoverflow.com/questions/4484517/submit-form-via-javascript – erikxiv 2012-01-15 16:03:37
这并没有解决..我没有我的答案。 – 2012-01-15 21:03:06