« AJAX Most Recent Bookmarks Live. | Main | Possible AJAX IE Exploint, the evil AJAX »

JSRS another PHP and AJAX implementation

Brent Ashley have an interestning AJAX implementation called JSRS. Javascript Remote Scripting (JSRS) is a client-side javascript library which uses Dynamic HTML elements to make hidden remote procedure calls to the server.

You can find JSRS here with examples for download, There is an example here in PHP of a remote Select Box Filling,

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.

Bookmark this article at these sites
Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):