Paul M Foster wrote: > I'm doing some massive (internal company) applications using PHP, which > query extensive PostgreSQL tables. This is fine, but obviously it often > requires multiple web pages to get something done. Supposedly, AJAX > promises to make web pages more interactive. But from what I understand, > I'd have to have bindings from Javascript into PostgreSQL to make this > work. > > Here's an example: The user wants to enter a bill (accounts payable) > into the system. He first has to pick a vendor. Normally, this would > entail a PHP page that generates a PostgreSQL query. The user would then > get a second page with various vendor information (like number of due > days for that vendor), and various other payable info. But wouldn't it > be nice to have vendor information filled in on the original page, > directly after the user picks a vendor? Theoretically, AJAX might allow > something like this. But from what I can see, it would require > PostgreSQL bindings in Javascript, and some way to pass the data back so > that PHP could use it. > > Is this even possible? Is it being worked on? Is there a different > solution I don't know about? I can see where Javascript can alter the > look of a page, but I can't work out how it would allow interactive use > of a PostgreSQL table. > No - AJAX is really talking about the ability to use client-side JavaScript to request XML documents from a server. In this case if you want to have a page show vendor information when a user selects a specific vendor, then your client-side JavaScript would request a resource on your server that will return that information in XML. If you're using PHP then the request you might make might be something like: http:/myserver.com/getVendorInfo.php The PHP request on the server goes to Postgres and retrieves the appropriate information, formats it as XML and writes it out like any other page. The client-side Javascript gets the XML response, uses client-side DOM to decode the response and changes the page HTML to include the appropriate information without having the page do a refresh. Obviously this is often not much faster than getting a different page, and is one of the fundamental problems with things like AJAX and SOA - each remote request is remote - it has to go over the internet and suffers not only the processing time at the database but also the network latency. But to answer your question - there is *not* coupling between JavaScript and Postgres. The JavaScript runs on the client, Postgres on the server and PHP as your intermediary. Best regards Pete -- Peter Wilson YellowHawk Ltd (http://www.yellowhawk.co.uk) Server Side XML and Javascript Web Application Server - http://www.whitebeam.org