In this code to send data by ajax, how is the data part interpreted? The id does not seem to assign it with the colon (:) why? Also, where does the id come from (if you need it, I'll pass the complete code). I am involved in this part (below I put the way that I usually understand it):
function eliminar (id){
var q= $("#q").val();
var id_categoria= $("#id_categoria").val();
$.ajax({
type: "GET",
url: "./ajax/buscar_productos.php",
data: "id="+id,"q":q+"id_categoria="+id_categoria,
beforeSend: function(objeto){
$("#resultados").html("Mensaje: Cargando...");
},
success: function(datos){
$("#resultados").html(datos);
load(1);
}
});
}
Until now I understood well how to pass the data like this:
function ejecutarAjax(event) {
event.preventDefault();
//alert("hola");
var datosEnviados =
{
'usuario' : $('#txtUsuario').val(),
'contra' : $('#txtPassword').val()
};
$.ajax({
type : 'POST',
url : 'registrar_usuario.php',
data : datosEnviados,
dataType : 'json',
encode : true,
But this way of passing the data baffles me could someone help me understand it?