Almost right but...
jmack159 wrote:i think you need something like JSON (javascript object notation). i don't know much about it, except that it is an interface between js and php (written in php).
JSON isn't written in PHP and isn't only for PHP, pretty much all mainstream languages support it.
The easiest way to think about JSON, is as a simple way to represent variables (arrays, objects etc) in a string form. That can then be processed by JavaScript and turned back into these.
You can read more about it at http://www.json.org/
If you just want the good stuff, go to http://www.json.org/js.html (at the very bottom you will find a open source JSON parser.
It will then return a string that you can do what you want with.
If you want something to deal with the JSON in php i believe there are pear modules for it and its built into PHP5