How can i pass an array with ajax? My code in view:
$(document).ready(function(){
$('#btn-send').click(function(){
var value = {
'name': $('#name').val(),
'phone': $('#phone').val(),
'mail': $('#mail').val(),
};
$.ajax({
type: 'POST',
url: '<?php echo site_url('customer_add/test'); ?>',
data: value,
success: function(resp){
$('#error').html(resp);
}
});
});
});
My test method:
public function test5(){
$data = $this->input->post["value"];
$name = $data['name'];
echo $name;
}
In params - in the inspect element - there are data but in response, there's nothing to return. What's wrong? Thank's in advance.
success : function(data) { //alert("ok"); }, error: function(er){ alert("There is some error"); console.log(er.responseText); }