i want to send an array to php via Ajax Json, but i cant do it, when i send it all i get on my server side is a csv string,
here is my jquery code where i create my array
$('#guardar_curso').click(function(){
var respuestas = new Array();
var a = 0;
var b = 0;
var c = 0;
var last_hidden = $('body').find('input[type="hidden"]').filter(':last');
last_hidden = parseInt(last_hidden.val()) + 1;
var count = 0;
for(var a = 0; a<last_hidden; a++){
for(var b = 0; b<4; b++){
c = $('body').find('input[name="resp['+ a +']['+ b +']"]').val();
if(c == ''){
respuestas[count] = c; //ignore this
}else{
respuestas[count] = c;
}
count++;
}
}
and this next is my jquery code where is my Ajax call triggered from a submit button:
$.ajax({
type:"POST",
url:CI.base_url + 'admin/guardar_curso',
data: curso_data + '&respuestas=' + respuestas,
dataType:"json",
success:function(response){
$.each(response, function(key, value){
salida = salida + value + "\n";
})
curso_data is my serialized data and "respuestas" is my array
it's just part of my code, i hope it helps make my point
any help i can get plz, this has been driving me nuts for hours, i want to loop that array with a foreach loop in php, thanks...