我有以下表格:
<form action="test.php" method="POST" onsubmit="loadXMLDoc(this.form); return false;">
<input class="com" type="text" name="test" />
</form>
而不是“this.form”,它需要在什么位置,以便用户输入的文本传递给loadXMLDoc?
另外:那是正确的语法然后发送这个变量数据吗?
function loadXMLDoc($testVariable)
//standard ajax code..
xmlhttp.send("test=" + $testVariable);
答案 0 :(得分:1)
表单可以按名称引用输入元素作为属性。
loadXMLDoc(this.test.value);