I have a little issues with my JS code.
I have a AJAX and I want to get the variable in PHP.
All works fine except the "param" data.
here is the code:
$('#signup_submit').click(function (event){
param = jQuery('input').filter(function() {
return this.name.match(/param/);
}).serialize();
event.preventDefault();
$.ajax({
type: "POST",
url: result.php,
data: {
action: 'submit_ajax',
email: $('#email').val(),
send_welcome: true,
listId: $('#listid').val(),
param: param
},
success: function(msg) {
console.log('ok');
}
});
});
The result var_dump for the param (PHP):
param%5Bconfirmation%5D=1
it should be something like:
array(1){ 'confirmation'=>1 }
Any idea to fix it?
thanks
json_encode
the array and echo it back to js.