Published on 2005-07-26 22:03:07

The idea of JSRS is interesting it uses a JSRS Server which dispatch client requests to return answers, the code below is from the example of Select Box Filling.

require("jsrsServer.php.inc"); jsrsDispatch( "makeList modelList optionsList" ); function makeList() { return serializeSql( "select makeID, makeName from makes order by makeName" ); } function modelList( $makeID ){ return serializeSql("select modelID, modelName from models where makeID=" . $makeID . " order by modelName"); } function optionsList( $modelID ){ return serializeSql("select optionID, optionName from options where modelID=" . $modelID . " order by optionName"); } function serializeSql( $sql ){ $link = mysql_connect("localhost", "mysql", "mysql"); mysql_select_db ("selectdemo"); $result = mysql_query ($sql); $s = ''; while ($row = mysql_fetch_row($result)) { $s .= join( $row, '~') . "|"; } mysql_close($link); return $s; }

There is vastly many approaches to AJAX and you can read here his post after coming back from the O'Reilly and Adaptive Path Ajax Summit.

Previous Page


Related Entries

Member of the PHP Magazine Network, Copyright (C) 2005-2008 phpmagazine.net All Rights Reserved