Destramic Posted May 15, 2010 Share Posted May 15, 2010 im looking for a script which allows you to selected a certian option on a form select box then a row of list boxes will show underneath depending on what the select box value is....does anyone know of a good link to such a script/site/tutorial if you dont understand let me know please...thank you Quote Link to comment Share on other sites More sharing options...
Destramic Posted May 15, 2010 Author Share Posted May 15, 2010 im finnal on to something now...but the script im trying to function keeps returning an error on the json "failed to submit"...can anyone tell me why please <!DOCTYPE html> <html> <head> <script type="text/javascript" src="/ajax/jquery/libary/jquery.js"></script> </head> <body> <?php $game_type = array(); $division = array(); if ($_POST['game'] == 1) { $game_type[] = array('value' => '1', 'text' => 'TDM' ); $division[] = array('value' => '1', 'text' => 'Divison 1' ); } elseif ($_POST['game'] == 2) { $game_type[] = array('value' => '1', 'text' => 'CTF' ); $division[] = array('value' => '1', 'text' => 'Divison 2' ); } json_encode($game_type); json_encode($division); ?> <form> <script> $(document).ready(function(){ $("select#game").change(function(){ $.ajax({ type: 'POST', data: 'data', dataType: 'json', cache: false, url: 'json.php', timeout: '2000', error: function() { alert("Failed to submit"); }, success: function(data) { alert("working!"); } }); // $('#game_type').html('<input type=\"checkbox\" value=\"test\" /> TDM'); // $('#division').html('<input type=\"checkbox\" value=\"test\" /> Division 1'); }); }); </script> <select name="game" id="game"> <option value=""></option> <option value="1">Counter Strike</option> <option value="2">COD</option> </select> <div id="game_type"> </div> <div id="division"> </div> </form> </body> </html> Quote Link to comment 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.