Pay attention to the following HTML:
<input type='text' id='name'/>
<option id='option'>
<select value='1'>hi</select>
<select value='2'>bye</select>
</option>
<input type='text' id='date'/>
This is a very simple form used to obtain user search criteria. I need to send these search criteria to the server using an AJAX call. What is the best data type / structure that can be used for this? And why ?
I am currently thinking of a string and JSON object. So I'll either pass
"John|2|2010-10-10"
to the server, or I'll pass
{"name":"John","option":2,"date":"2010-10-10"}
Perhaps there are other creative ways to address your search criteria? This criterion is removed to the server only once, it does not return to js.
Thank.
source
share