hi guys i been fighting with this im trying to pass a jquery value to a php variable
this is my code
$('body').on('change','#select_ref',function(){
var name = $(this).val();
var dataString = "name=" + name;
$.ajax ({
type: "POST",
url: "referencia_select.php",
data: dataString,
dataType: 'json',
success: function(data) {
// console.debug(data);
$('#vendedor').val(data.id_vendedor);
$('#name').val(data.name);
$('#email').val(data.email);
$('#compa').val(data.lastname);
$('#rfc').val(data.rfc);
$('#phone').val(data.phone);
$('#fax').val(data.fax);
$('#address').val(data.address);
$('#estado').val(data.estado);
$('#city').val(data.city);
$('#zipcode').val(data.cp);
$('#productos').val(data.productos);
}
});
});
i already try sending it with cookies
var productos = data.productos;
document.cookie = "products=" + productos ;
console.log(productos);
on my php
try
$variable = $_POST['products'];
$variable = $_COOKIE['products'];
and different methods with not luck any subjection to make this work for my application
im able to chage a input with the data
<input type="text" name="productos" id="productos" value="" data-array="12,12,Productos" />
but i really need it in a php variable thanks a lot