fife Posted July 9, 2012 Share Posted July 9, 2012 Hi all. Im trying to create a duel dropdown list with an ajax call to populate the second list. My first list works ok but the second list is not working at all. Here is my code the header info for the ajax call <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $(".networks").change(function() { var id=$(this).val(); var dataString = 'id='+ id; $.ajax ({ type: "POST", url: "http://www.saph.info/members/iframes/foldersquery.php", data: dataString, cache: false, success: function(html) { $(".folder").html(html); } }); }); }); </script> the first dropdown list <label for="networks" ></label> <select name="networks" id="networks" class="networks"> <?php $sql=mysql_query("SELECT * FROM networks WHERE type = '1'"); while($row=mysql_fetch_array($sql)) { $id=$row['idnetworks']; $data=$row['netname']; echo '<option value="'.$id.'" >'.$data.'</option>'; } ?> </select> then I have a page called foldersquery.php with the query for the second drop down include('../../Connections/db.php'); if($_POST['id']) { $id=$_POST['id']; mysql_select_db($database_db, $db); $query_rs_folders = "SELECT * FROM documents WHERE type = '1' AND network = '$id' "; $rs_folders = mysql_query($query_rs_folders, $db) or die(mysql_error()); while($row=mysql_fetch_array($rs_folders)) { $id=$row['iddocs']; $data=$row['documentname']; echo '<option value="'.$id.'">'.$data.'</option>'; } } I have no idea where my error is. Thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/265413-duel-drop-down-list-select-list/ Share on other sites More sharing options...
handlegeek Posted July 29, 2012 Share Posted July 29, 2012 You can check if the AJAX request is successful by looking into the request and response in your browser: Firefox -> Firebug or Chrome Web Inspector "Net" tab. This will show the request parameters and the response (including headers) of the Ajax request which will help in debugging the issue. Quote Link to comment https://forums.phpfreaks.com/topic/265413-duel-drop-down-list-select-list/#findComment-1365235 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.