<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<script type="text/javascript" src="js/funciones.js"></script>
<link href="css/jquery.multiselect.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="js/jquery.multiselect.js"></script>
</head>
<body>
<center>
<br/>
<br/><br/>
<label>DNI</label>
<input type="text" id="dni">
<br/><br/>
<label>NOMBRE</label>
<input type="text" id="nombre">
</br></br>
<select class="test" id="tecnologia" name="tecnologia[]" multiple="multiple">
<option value="2g">2G</option>
<option value="3g">3G</option>
<option value="4g">4G</option>
<option value="tdd">TDD</option>
</select>
<script>
$('document').ready(function(){
$('#tecnologia').multiselect({
columns: 1,
placeholder: 'Selecciona la tecnologia',
search: true,
selectAll: true
});
});
</script>
<button onclick="anadir();">Añadir</button>
<input type="submit" onclick="buscar()" value="buscar">
</body>
</html>
I have an html code in which I am using jquery.multiselect.css, jquery.multiselect.js, jquery-2.1.3.js and I link it to a javascript functions.js.
When calling my bd values using JSON, it does not show them, but they are called. I do not know that the check boxes are not marked, and I would like to know how I can fix that.
function buscar(){
var parametros={"dni": $("#dni").val(),}
$.ajax({
type: 'post',
url: '../lunes-5/buscardatos.php',
data: parametros,
dataType: 'json',
success: function(d){
$("#nombre").val(d[0]);
$.each(d[1].split(","), function(i,e){
$("#tecnologia option[value='"+e+"']").prop("selected",true);
});
$("#tecnologia").multiselect("refresh");
}
});
}
in the JS I refresh to refresh my data but it does not ... is there any way to show me the marked multiselect check?
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("archivos",$con);
$dni=$_POST["dni"];
$rs=mysql_query("SELECT * FROM clie WHERE dni='$dni'");
$row = mysql_fetch_assoc($rs);
$datos_a_enviar = array($row['nombre'],$row['tecnologia']);
echo json_encode($datos_a_enviar);
?>