D
Dominic Myers
In the full and frank knowledge that someone will
doubtless refer me to google and probably tell me
to wipe my own arse I was wondering if someone
could shed some light on the following problem for
me?
I have a number of select blocks that I want to
get the data from into a PHP script on the server
(I know, sounds very AJAXie doesn't it?). I'm
thinking that about the best way to do this would
be via JSON and the following structure would be
ideal really:
[ { 'select0' : 'CSB1030C' },
{ 'select1' : 'CSB1005C' },
{ 'select2' : 'CSB1039C' },
{ 'select3' : 'MSB1016' },
{ 'select4' : 'CSB1003C' },
{ 'select5' : 'CSB1038C' } ]
The selects take this form:
<select id="select0" onchange="">
<option value="CSB1030C">abc</option>
<option value="CSB1005C">def</option>
<option value="CSB1039C">efg</option>
<option value="CSB1038C">hij</option>
etc...
</select>
<select id="select1" onchange="">
<option value="CSB1030C">abc</option>
<option value="CSB1005C">def</option>
<option value="CSB1039C">efg</option>
<option value="CSB1038C">hij</option>
etc...
</select>
<select id="select2" onchange="">
<option value="CSB1030C">abc</option>
<option value="CSB1005C">def</option>
<option value="CSB1039C">efg</option>
<option value="CSB1038C">hij</option>
etc...
</select>
etc...
How do I get the onchange thing on each of the
selects to grab the selected values for all of the
selects and pass it to the server using JSON. I
can grab the data fine using the DOM (even
FireFox's interesting implementation of the DOM
isn't insurmountable really), but I can't figure
out how to encode the data. I'm reading a lot
about eval() but also seeing that some people feel
that it is evil...?
Any help would be greatly appreciated... just a
pointer or two would be cool as I feel as though
I've been bashing my head against this for 4 days
now :-(
Cheers in advance,
Dom
doubtless refer me to google and probably tell me
to wipe my own arse I was wondering if someone
could shed some light on the following problem for
me?
I have a number of select blocks that I want to
get the data from into a PHP script on the server
(I know, sounds very AJAXie doesn't it?). I'm
thinking that about the best way to do this would
be via JSON and the following structure would be
ideal really:
[ { 'select0' : 'CSB1030C' },
{ 'select1' : 'CSB1005C' },
{ 'select2' : 'CSB1039C' },
{ 'select3' : 'MSB1016' },
{ 'select4' : 'CSB1003C' },
{ 'select5' : 'CSB1038C' } ]
The selects take this form:
<select id="select0" onchange="">
<option value="CSB1030C">abc</option>
<option value="CSB1005C">def</option>
<option value="CSB1039C">efg</option>
<option value="CSB1038C">hij</option>
etc...
</select>
<select id="select1" onchange="">
<option value="CSB1030C">abc</option>
<option value="CSB1005C">def</option>
<option value="CSB1039C">efg</option>
<option value="CSB1038C">hij</option>
etc...
</select>
<select id="select2" onchange="">
<option value="CSB1030C">abc</option>
<option value="CSB1005C">def</option>
<option value="CSB1039C">efg</option>
<option value="CSB1038C">hij</option>
etc...
</select>
etc...
How do I get the onchange thing on each of the
selects to grab the selected values for all of the
selects and pass it to the server using JSON. I
can grab the data fine using the DOM (even
FireFox's interesting implementation of the DOM
isn't insurmountable really), but I can't figure
out how to encode the data. I'm reading a lot
about eval() but also seeing that some people feel
that it is evil...?
Any help would be greatly appreciated... just a
pointer or two would be cool as I feel as though
I've been bashing my head against this for 4 days
now :-(
Cheers in advance,
Dom