I want to transmit data via POST to a remote script. A set of data is generated with Javascript and I would to know what's the best practice for gathering data before sending it. I tried to use:
<ul>
<li>Item added a开发者_Python百科t runtime</li>
</ul>
I included all of these in a form, but I can't access the information on the server. What's the most popular approach for this problem? (I want to access the generated items on the server)
Thanks!
What you need to do is create hidden form elements. <ul>
and <il>
are not form elements.
You can find an example here: http://www.javascript-coder.com/javascript-form/javascript-set-form-field.htm
Now, another thing you can do is utilize AJAX to POST data. There are a handful of frameworks that make this process very simple. I recommend jQuery or YUI.
I think that usually, at least on the not compiled languages that work over web (php or classing asp f.e) this work is done with html hidden fields. When a post is executed, the user can't see that controls on the form but they actually travel to the server.
You can get this values without problem.
Have I understand your question correctly?
http://www.w3schools.com/jsref/dom_obj_hidden.asp
精彩评论