需要从页面中提取 XML,然后将其转换为 HTML 形式。页面是通过POST方法生成的
好吧,这就是发生的事情。
我有一个表单,填写详细信息,然后按提交,它将发布到另一个站点(他们的服务器),并在该页面上返回一个 XML 文档。结果端的 URL 始终相同。
现在,对于生成的 XML,我需要获取它并将其放入原始站点上的 HTML 表单中。
理想情况下,我想按提交,而不是重定向到输出所在的站点,并将输出自动解析为新的 HTML 表单。我尝试查看 xmlHTTP 请求,但无法听到它的声音...
好的,这是表单发布位:
<form target="_blank" action="www.websiteipostto.com" method="POST">
然后我带着 XML 文档到达 www.websiteipostto.com。我将非常感谢任何帮助。
问候
Ok here's what happens.
I have a form, I fill it out with details, I then press submit, and it will post to another site (their server) and on that page it will return an XML document. The URL is always the same on the result end.
Now, with the XML that was generated I need to get it and put it into a HTML form on the original site.
Ideally, I want to press submit, not be redirected to this site where the output is, and have the output be automatically parsed into a new HTML form. I have tried looking at xmlHTTP requests and can't get my heard around it...
Ok here is the form post bit:
<form target="_blank" action="www.websiteipostto.com" method="POST">
I then arrive at www.websiteipostto.com with the XML document there. I will greatly appreciate any help.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您按提交时,您希望:
第一个表单可以通过
return false 在
submit
事件上。它将取消默认的“重定向”操作。第二个需要对 XML 进行一些解析。
您可以根据对此 XML 数据的具体需求填写空白。有关 jQuery 如何处理 XML 数据的更多信息可以在此处找到
When you press the submit, you want to:
The first one could be handled by
return false
on thesubmit
event. It will cancel the default 'redirecting' action.The second one needs some parsing with XML.
You could fill in the blank with your specific need for this XML data. More information about how jQuery handle XML data could be found here
如果您想在客户端执行所有操作,这将有所帮助:
http://api.jquery.com/ jQuery.post/ 用于发送请求
http://api.jquery.com/serialize/ 为
你 做好准备需要从响应中解析 xml: XML parsing of a variable string in JavaScript
If you want to do everything on clientside, this will help:
http://api.jquery.com/jQuery.post/ for sending request
http://api.jquery.com/serialize/ for prepraing it
you would need to parse xml from response: XML parsing of a variable string in JavaScript