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
- <div id="controlSoft" class="controls">
-
- <select multiple="multiple" id="my_multi_select1" name="my_multi_select1[]">
-
- <option value="dads"> </option>
-
- <option id="softHint"/>
-
- </select>
-
- </div>
PHP
- <?php
-
- $q = intval($_GET['q']);
-
- $con = mysqli_connect("127.0.0.1", "root", "");
- if (!$con) {
- die('Could not connect: ' . mysqli_error($con));
- }
- mysqli_select_db($con,"pcd");
-
- $querySoftware="SELECT * FROM software WHERE id_barebone = '".$q."'";
- $resultSoftware = mysqli_query($con,$querySoftware);
-
- while($row = mysqli_fetch_assoc($resultSoftware)) {
-
- echo "<option value='".$row['software']."'>".$row['software']."</option>";
-
- }
- mysqli_close($con);
- ?>
JS
- function updateSoftware(str) {
- if (str=="") {
- document.getElementById("softHint").innerHTML="";
- return;
- }
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp2=new XMLHttpRequest();
- } else { // code for IE6, IE5
- xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp2.onreadystatechange=function() {
- if (xmlhttp2.readyState==4 && xmlhttp2.status==200) {
- document.getElementById("softHint").innerHTML=xmlhttp2.responseText;
- }
-
- }
- xmlhttp2.open("GET","updateSoftware.php?q="+str,true);
- xmlhttp2.send();
- }
TY