Getting Started
Learning anything new takes time and effort, I have tried to simply this learning curve as much as possible.
For the first tutorial lets start with a very common and widely used auto-completing effect.This tutorial is also availible in your demos directory.
- First thing you need to do is install Projax and include the file in your script.
- Now lets create a new instance of Projax though which all the functionality will be accessed.
$projax = new Projax(); - Once you have intialized the class lets show the input box which requires auto-completion.
Please enter your year of birth :
<?=$projax->text_field_with_auto_complete('dob',null,array('url'=>'index.php?task=ajax'));?> - When you enter anything into this it will call the url index.php?task=ajax , Itll pass the current value of dob as $_POST['dob'].The called page should return a list of matching values.
for($i=1900;$i<2006;$i++)$ret_val.=(strstr($i,$_POST['dob']))?'<li>'.$i.'</li>':'';
echo '<ul>'.$ret_val.'</ul>';
See how simple it was.