jQuery Multi Select not load option values with ajax

jQuery Multi Select not load option values with ajax

Hi,

Values ​​sent by php are not loaded properly in the plugin. Can anyone help me?





HTML

  1. <div id="controlSoft" class="controls">

  2. <select  multiple="multiple" id="my_multi_select1" name="my_multi_select1[]">
  3. <option value="dads"> </option>
  4. <option id="softHint"/> 
  5. </select>
  6. </div>

PHP

  1. <?php
  2. $q = intval($_GET['q']);
  3. $con = mysqli_connect("127.0.0.1", "root", "");
  4. if (!$con) {
  5. die('Could not connect: ' . mysqli_error($con));
  6. }
  7. mysqli_select_db($con,"pcd");
  8. $querySoftware="SELECT * FROM software WHERE id_barebone = '".$q."'";
  9. $resultSoftware = mysqli_query($con,$querySoftware);
  10. while($row = mysqli_fetch_assoc($resultSoftware)) {
  11. echo "<option value='".$row['software']."'>".$row['software']."</option>";
  12. }
  13. mysqli_close($con);
  14. ?>

JS

  1. function updateSoftware(str) {
  2. if (str=="") {
  3. document.getElementById("softHint").innerHTML="";
  4. return;
  5. if (window.XMLHttpRequest) {
  6. // code for IE7+, Firefox, Chrome, Opera, Safari
  7. xmlhttp2=new XMLHttpRequest();
  8. } else { // code for IE6, IE5
  9. xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
  10. }
  11. xmlhttp2.onreadystatechange=function() {
  12. if (xmlhttp2.readyState==4 && xmlhttp2.status==200) {
  13. document.getElementById("softHint").innerHTML=xmlhttp2.responseText;
  14. }
  15. }
  16. xmlhttp2.open("GET","updateSoftware.php?q="+str,true);
  17. xmlhttp2.send();
  18. }
TY