php - Ajax not generating source code -


i added script website generates chained selection system. works ok when tried fetch data in search script realized won't generate source code can use. attach parts think important able fix problem. please let me know before downrating. thanks!

<script type="text/javascript"> $(document).ready(function() {     $('#wait_1').hide();     $('#judet').change(function(){       $('#wait_1').show();       $('#result_1').hide();       $.get("func.php", {         func: "judet",         drop_var: $('#judet').val()       }, function(response){         $('#result_1').fadeout();         settimeout("finishajax('result_1', '"+escape(response)+"')", 400);       });         return false;     }); });  function finishajax(id, response) {   $('#wait_1').hide();   $('#'+id).html(unescape(response));   $('#'+id).fadein(); } </script> 

the html part:

<tr>                                         <td><label>judet</label></td>                                         <td><select name="judet" id="judet">                                                 <option value="" selected="selected" disabled="disabled">selecteaza judetul</option>                                                  <?php gettierone(); ?>                                             </select></td>                                                                                                               <tr>                                         <td><label>localitate</label></td>                                         <td>                                             <span id="wait_1" style="display: none;"><img alt="asteptati..." src="images/ajax-loader.gif"/></span>                                              <span id="result_1" style="display: none;"></span>                                         </td>                                     </tr> 

the php part:

function judet($drop_var) {       include_once('mysql_connect.php');     $result = mysql_query("select * orase judet='$drop_var'")  or die(mysql_error());  echo '<select name="tier_two" id="tier_two">       <option value=" " disabled="disabled" selected="selected">selecteaza localitatea</option>';         while($drop_2 = mysql_fetch_array( $result ))          {              echo '<option value="'.$drop_2['oras'].'">'.$drop_2['oras'].'</option>';         }  echo '</select>'; } 

in case problem relatively simple didn't stopped me keep trying whole day find solution. learned few things today , script working it's in end. had add hidden input in html part this:

<input type='hidden' name="locatie" value="<?php echo $_post['tier_two']; ?>" > 

then able it's value , use wanted using variable equal $_post['tier_two'];. in case run in problem note ajax not display source code expect, need firebug or similar tool. however, time solved problem without using one. luck!


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -