简体   繁体   English

从动态形式获取价值

[英]Getting values from dynamic form

I have a .html which is a form with some selects, inputs.. in JQuery Mobile. 我有一个.html,它是JQuery Mobile中具有一些选择,输入..的形式。 The form is generated dynamically because at first I ask to a web service for the data needed, so once I have the information from the server I start to 'paint' the html with Javascript (For example: if (string) document.write + ...) It is working fine but now I have to get that data and send it back to the server. 该表单是动态生成的,因为起初我会向Web服务请求所需的数据,所以一旦我从服务器获取了信息,便开始用Javascript“绘制” HTML(例如:if(string)document.write + ...)工作正常,但现在我必须获取该数据并将其发送回服务器。

My doubt is that I don't know if there is a 'best' way to do it. 我的疑问是,我不知道是否有“最佳”方法。 I have thought in generate and store the ID's from each parameter and the type in a array at same time I paint them and after ask them about the values. 我考虑过在绘制它们并询问它们有关值之后,同时根据每个参数和类型将ID生成并存储在数组中。

It could be done that way? 可以那样做吗? I have read about generate an array when clicking 'submit' and then generate the parameters but I can't see it clearly because I don't send that data literally, I have to process it first generating and XML and that stuff. 我已经读过有关单击“提交”然后生成参数时生成数组的信息,但是我看不清它,因为我没有按字面意思发送该数据,我必须先处理它,再生成XML和诸如此类的东西。

I know it could sound like a mess =(, sorry for my english and thanks in advance. 我知道这听起来像是一团糟=(,对不起,我的英语,在此先感谢。

EDIT: 编辑:

This is an example of my JS code 这是我的JS代码的示例

在此处输入图片说明

So it could generate 1, 2, 3.. infinites Strings interfaces (well, not that much) so if I want a function to recollect the values of the 'inputs', 'selects'... generated, how could I do it? 因此它可以生成1、2、3 ..无限字符串接口(嗯,不是那么多),所以如果我想要一个函数来重新收集“ inputs”,“ selects” ...的值,我该怎么做?

Tutorial to form post 补习教程

Basically you specify the form to post to a specific URL, and then you just need your server to handle the response. 基本上,您指定要发布到特定URL的表单,然后只需要服务器来处理响应。 The link above should be helpful in figuring it out! 上面的链接应该有助于找出答案! Alternatively, you can use AJAX to send data as well. 另外,您也可以使用AJAX发送数据。 Let me know if you have any questions! 如果您有任何疑问,请告诉我!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM