Quote from: OpenGeek at Jan 04, 2006, 02:35 PM
Can you try and explain how the AJAX calls would work. We all need to understand this, and I don’t need documentation, just some description of the how the methods will interact with the documentObject and the parser...
When a page is loaded it will be treated as an object. This means that the system will invoke specific page events as it does currently in 0.9.1 in addition to a few other event handlers such as OnHandlePostBack and OnHandleAjaxRequest.
The OnHandleAjaxRequest will be invoked if call is make to the page using client-side (javascript) Request object.
// client-side
<form name='myform'>
Name: <input type="text" name="username" />
<input type="button" value="Submit" onclick="Request.post('myform');" />
</form>
<?php
// some other object code here
// server-side
function OnHandleAjaxRequest($event){
$cli = $this->cms->client;
$cli->alert('Hello, your name is '.$_POST['username']);
}
// some object other code here
?>
The system will then automatically handle the sending of information to and from the server.
Please see the attached file as it demonstrates some other ajax features of the client extension. In this demo all element manipulation was done from the server. Note: This is not a fully MODxified demonstration.