Re: JSON help
- From: "impaler" <TamasJano@xxxxxxxxx>
- Date: 26 Jan 2006 01:03:50 -0800
>
> 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...?
Let me undestand exactly what you want.
Do you need to pass an object to the server ? Do you want to have all
the selected options back on the server? You need no JSON for this.
JSON stand for JavaScript Object Notation and it's often used by server
side scripts to deliver ready to use objects for javascript not vice
versa. Of course you can do it, but is too much overhead to deserialize
a json format when all you have to do is pass a comma separated list of
key:value pairs for instance.
Build something like this:
'select0:CSB1030C,select1:CSB1005C....
and you can split having the comma as separator thus obtaining the
key:value pairs and do a split on all these pairs having the colon as
separator and there you have them.
on the onchange event you can have a function that builds this string
and if you use XMLHttpRequest to pass it...use it in this function but
beware of launching multiple requests before the server response.
.
- References:
- JSON help
- From: Dominic Myers
- JSON help
- Prev by Date: onmousemove problems with internet explorer
- Next by Date: applying indent on divs i a tree structure
- Previous by thread: Re: JSON help
- Next by thread: Re: JSON help
- Index(es):
Relevant Pages
|