PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Neeraj Thakur  >  AJAX Drop-down  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Demonstration file
Class: AJAX Drop-down
Update the options of a select input using AJAX
Author: By
Last change:
Date: 15 years ago
Size: 1,317 bytes


Class file image Download
    <script language="JavaScript" src="ajax.js"></script>
    <link href="css.css" rel="stylesheet" type="text/css"/>
<div id="loading"></div>

    <table border=0 cellpadding=0 cellspacing="0" align="center" width="40%">
        <tr><td colspan="2" height="25"></td></tr>
        <tr><td colspan="2" class="textheading">AJAX Dropdown to Dropdown</td></tr>
        <tr><td colspan="2" height="25"></td></tr>
        <tr><td class="text" width="50%">Select category : </td><td>
$obj = new AjaxDropdown();
$arr = $obj->getArray(0);
$strRet .= '<option value="0">--Select--</option>';
                    foreach (
$arr as $row )
$strRet .= '<option value="'.$row->id.'">'.$row->Name.'</option>';
<select name="selCat" class="text" onChange="javascript:Ajax.Request('getagents.php?method=getXML&param=',this.value, Ajax.Response);">
                    <?php echo $strRet; ?>
                <tr><td colspan="2" height="5"></td></tr>
                <tr><td class="text">Sub categories :</td><td>
                <select name="selSubCat" id="selSubCat" class="text">
                    <option value="0">--Select--</option>
                    <option value="12">test</option>

For more information send a message to info at phpclasses dot org.