I have the following ajax and I want to send "data.php" to the data that my object obj
has but it does not do it and it sends me the alert ("Unable to recover the data ...");
$.ajax({
url: 'http://nombre_server/datos.php',
method: 'POST',
data: obj,
success: function(data){
console.log(data);
alert(data);
},
error: function(data) {
alert("No se pueden recuperar los datos...");
}
});
the object obj
I formed it in the following way
$("#lista div input, #lista div select").each(function(i,e){
obj.push({
id:$(this).attr("id"),
valor:$(this).val()
});
});
console.log(obj);
and printing the obj in console shows it in the following way
(10) [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
0
:
Object
id
:
"0"
valor
:
"true"
__proto__
:
Object
1
:
Object
id
:
"1"
valor
:
"echo"
and in the file datos.php it shows me
undefined:
undefined:
undefined:
undefined: //son 10 undefined en total
The problem is that I do not know why ... I do not know what's wrong with someone who can help me.