stripeskid Posted June 5, 2012 at 08:13 PM Report Share #460678 Posted June 5, 2012 at 08:13 PM (edited) Boas malta, Eis o meu codigo: function getCombo1(sel) { var valid = sel.options[sel.selectedIndex].value; jQuery(function($) { $(document).ready(function() { $("#Loading").hide(); $(".letter").bind('click', function(){ $("#Loading").fadeIn(); //show when submitting var val = $(".letter").val; $.ajax({ url:'pages/admin/adm_funcs.php?letter='+$(this).html() +'&value='+ valid, success:function(data){ $("#Loading").fadeOut('fast'); //hide when data's ready $("#content").html(data); } }); }); }); }); } <select id="combo1" onchange="getCombo1(this)"> <option value="">Selecione um sector:</option> <?php if ($resultado === FALSE) echo "<p>Não foi possivel resolver a query.</p>" . "<p> Erro: " . mysql_errno($dbConnect) . ": " . mysql_error($dbConnect) . "</p>"; else { while($row = mysql_fetch_array($resultado)) { echo'<option value="'.$row['idSector'].'">'.$row['Nomesec'].'</option>'; } } mysql_close($dbConnect); ?> </select> Notas: As querys estão a funcionar corretamente. O id da combobox é passado corretamente. Os meus dados apresentados dependem do valor (id) que vem da combobox Problema: O script roda o numero de vezes que eu fizer o uso da combobox, ou seja sempre que seleciono outras opcoes. Chega a um ponto que este link está a rodar +-assim: pages/admin/adm_funcs.php?letter='+$(this).html() +'&value='+ 1 pages/admin/adm_funcs.php?letter='+$(this).html() +'&value='+ 2 pages/admin/adm_funcs.php?letter='+$(this).html() +'&value='+ pages/admin/adm_funcs.php?letter='+$(this).html() +'&value='+ 1 etc etc Ha maneira de cada vez que mudo os valores da combobox os que estão para trás sejam largados? Espero ter me explicado bem, nao e facil. Edited June 6, 2012 at 07:03 PM by brunoais geshi! Link to comment Share on other sites More sharing options...
brunoais Posted June 5, 2012 at 09:58 PM Report Share #460736 Posted June 5, 2012 at 09:58 PM (edited) Tens aí o código, mas não o consigo entender. Seria melhor se indentasses isso melhor. Já agora: Java =/= Javascript. Edited June 5, 2012 at 09:59 PM by brunoais "[Os jovens da actual geração]não lêem porque não envolve um telecomando que dê para mirar e atirar, não falam porque a trapalhice é rainha e o calão é rei" autor: thoga31 Life is a genetically transmitted disease, induced by sex, with death rate of 100%. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now