我想将用户表单输入作为XML发布到URL并返回结果以显示给用户。
HTML的部分:
<form id="postXmlForm" method="post">
<table>
<tr>
<td>Userinput1:</td>
<td><input type="number" id="userInput1" name="userInput1"></td>
</tr>
<tr>
<tr>
<td>Userinput2:</td>
<td><input type="text" id="userInput2" name="userInput2"></td>
</tr>
<tr>
<td colspan="2"><input type="Button" value="Send"></td>
</tr>
</table>
</form>
我应该发布到网址:
<Request><input1>123456</input1>
<input2>textinoput</input2></Request>
我不确定,最好的方法是将用户输入包装成一个字符串并将其作为XML发布到给定的URL并显示答案(XML)... jQuery? PHP?
答案 0 :(得分:0)
我不确定为什么要将数据作为XML传递到目标页面,而通过post方法传递变量非常简单安全,但作为回应,您可以回显任何格式包括XML。但是如果你想要传回一组参数,我的推荐是JSON。
JQuery有getJSON,可以轻松帮助您解析JSON。