in reply to perl javascript XML
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl javascript XML
by blenkhn (Acolyte) on Sep 21, 2005 at 22:49 UTC | |
Webpage javascript askes server script for information to fill first drop down. Server Script responds with an xml document. Webpage Javascript parses information and displays in second Dropdown list Process is repeated for the third dropdown list. Is this what the JSON module would do for me? Is it possible to setup the web-page to handle multiple sets of the dropdown lists? 10 for example? (I have found a method that the other 9 would not show up until the first is filled) Can you provide an example of it working? thanks for your help | [reply] |
by ickyb0d (Monk) on Sep 22, 2005 at 21:47 UTC | |
This method is described here. If you were still interested in trying an XML solution you can look here. Granted that's a php solution, but you'd just print out the XML as i do in the first snipet of code with the JSON. all in all it's just a matter of getting a string back from your perl script. Then using the request.responseText. Then doing whatever you want to that string; whether it's parsing XML or evaluating it to create a JavaScript Object. If your giving a string to your perl script, that's when you might use the JSON module to interpret the string into a perl object. If you still wanted to go the XML route, it's pretty much the same concept, except use an XML module to create/dump perl object from/to XML, then have the JavaScript interpret it. Looks like there's plenty XML modules on CPAN. Hope this helps. Employee.pcgi in this @employees is just an array of hashes
And here's what the javascript might look like. employee.js
| [reply] [d/l] [select] |