PDA

View Full Version : Dynamic Ajax Load Help...Jscheur??



santamonica10
03-26-2008, 07:11 AM
1) Script Title: Dynamic Ajax Load

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:
I am working on a site and am using ajaxpage for multiple dropdown menus. The first drop down menu works fine in opening the next menu using ajax, but then the second menu will not load anything. I believe that I need to manually trigger the ajaxload script again since the new content has been loaded into the page after the script initially loaded. I tries reloading the script using the loadvars object. Here is the url to my page:
www dot coreymichaelstudio dot com/janmar/cat-recessed-lu.php
The ajax is being used on the "select model" menu.


<!--Start Manufacturer-->
<label for="manufacturer">Select Manufacturer</label>
<select id="manufacturer" class="dropdown" name="manufacturer" title="manufacturer">
<?php while ($mfg = mysql_fetch_assoc($mfgresult)){
$manufacturer = $mfg['manufacturer'];
echo '<option onclick="ajaxpage("modules/lu/model.php?cmh=$cmh&mfg=$mfg", "model-selector");" value="'.$manufacturer.'"><p>'.$manufacturer.'</p></option>';
}
mysql_free_result($mfgresult);
?>
</select>
<!--End Manufacturer-->


Thanks in advance for any help!!! :)

Nile
03-27-2008, 02:37 AM
Switch:


<option onclick="ajaxpage("modules/lu/model.php?cmh=$cmh&mfg=$mfg", "model-selector");"

To:


<option onclick="ajaxpage(\'modules/lu/model.php?cmh=$cmh&mfg=$mfg\', \'model-selector\');"

This should work. :)

thetestingsite
03-27-2008, 02:47 AM
Actually, this would be a better solution:



<!--Start Manufacturer-->
<label for="manufacturer">Select Manufacturer</label>
<select id="manufacturer" class="dropdown" name="manufacturer" title="manufacturer">
<?php
while ($mfg = mysql_fetch_assoc($mfgresult)) {
$manufacturer = $mfg['manufacturer'];
?>
<option onclick="ajaxpage('modules/lu/model.php?cmh=<?php echo $cmh; ?>&mfg=<?php echo $mfg; ?>', 'model-selector');" value="<?php echo $manufacturer; ?>"><p><?php echo $manufacturer; ?></p></option>
}
mysql_free_result($mfgresult);
?>
</select>
<!--End Manufacturer-->


Or even this would suffice:



<!--Start Manufacturer-->
<label for="manufacturer">Select Manufacturer</label>
<select id="manufacturer" class="dropdown" name="manufacturer" title="manufacturer">
<?php while ($mfg = mysql_fetch_assoc($mfgresult)){
$manufacturer = $mfg['manufacturer'];
echo '<option onclick="ajaxpage(\'modules/lu/model.php?cmh='.$cmh.'&mfg='.$mfg.'\', \'model-selector\');" value="'.$manufacturer.'"><p>'.$manufacturer.'</p></option>';
}
mysql_free_result($mfgresult);
?>
</select>
<!--End Manufacturer-->


Hope this helps.