javascript - dynamic reloading of a combobx when hetting a refresh button? -


am new ajax , , i'm having trouble implement dynamic reloading of combobox when hetting refresh button.

    <html> <head>      <script type="text/javascript">     $(function() {     alert('document ready');     $('#b').on('click', function(){      alert('you clicked button');     $('#s').load(test.php);  });   });  </script> </head> <body>  <select name="s" id="s">  <?php       $server = 'localhost'; //localhost usual name of server if apache/linux. $login = 'root'; $pword = ''; $dbname = 'item'; mysql_connect($server,$login,$pword) or die($connect_error); //or die(mysql_error()); mysql_select_db($dbname) or die($connect_error); ?> <?php     $query = "select * ajax_categories";     $results = mysql_query($query);      while ($rows = mysql_fetch_assoc(@$results))     {?>         <option value="<?php echo $rows['id'];?>"><?php echo $rows['category'];?></option>     <?php     }?>  </select> <input type = "button" value="go" name="b" id="b"> 

and test.php code :

    <?php     $query = "select * ajax_categories";     $results = mysql_query($query);      while ($rows = mysql_fetch_assoc(@$results))     {?>         <option value="<?php echo $rows['id'];?>"><?php echo $rows['category'];?></option>     <?php     }?> 

it shows alert combobox doesnt reloading new database content

try changing :

 $('#s').load(test.php); 

to :

 $('#s').load('test.php'); 

string literals important.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -