I have a problem when I call the show products by quality and specialty () . Before I had only the first two parameters, but when I added the third data.name I got the following error:
Uncaught ReferenceError: MADRID is not defined at: 1: 52 This function collects the parameters:
function mostrarproductosporlocalidadyespecialidad(id_localid, cat, nombrePoblacion)
These values would be picking up the function: show products by quality and specialty (29077,45, MADRID)
Can you throw some light on me, please?
$.ajax({
data: params,
url: 'adminasesmed/obtenerlugares.php',
type: 'post',
dataType: 'json',
success: function(response){
var cat;
cat = getUrlVars();
var data;
/*Liampiamos el div antes de ejecutar otra busqueda*/
$("#localidades").html("");
/*Volvemos a llenar el div*/
var html = "<ul style=''>";
$.each(response, function(index, data){
html += "<li><a style='display: block;color: #000;padding: 8px 16px;text-decoration: none; :hover background-color: #555;color: white' href='javascript:mostrarproductosporlocalidadyespecialidad(" + data.id_localidad + "," + cat + "," + data.nombre + ")'>" + data.nombre + " - (" + data.codigoProvinciaAsesmed + ")</a><li>";
console.log(html);
});
html += "</ul>"
$("#localidades").append(html);
}
})