I'm making a jQuery .post() with the following arrays:
'cleanedLinkStructureArray[]': cleanedLinkStructureArray,
'cleanedPermaLinkArray[]': cleanedPermaLinkArray
The data inside these arrays: cleanedPermaLinkArray looks like this: ["2012","10","30","hello-world"] and cleanedLinkStructureArray like this: ["year","monthnum","day","postname"]
Javascript code:
var ajaxPost = $.post(
enableAJAX.ajaxurl,
{ action: 'ajaxRequest',
'ajaxRequestNonce' : enableAJAX.ajaxRequestNonce,
'cleanedLinkStructureArray[]': cleanedLinkStructureArray,
'cleanedPermaLinkArray[]': cleanedPermaLinkArray },
'json'
);
ajaxPost.done(function(responseText) {
alert(responseText);
console.log(responseText);
});
ajaxPost.fail(function() {
alert("Oops, I'm afraid we've broken something");
});
I don't understand how I catch the two arrays in PHP? and use the data from the arrays inside PHP? Preferably I would create new PHP array with them, where the values inside cleanedLinkStructureArray become the keys for the array and the values inside cleanedPermaLinkArray the values for that new array.
I guess it must be something with this, but I need someone more experienced to tell me what I need to do here.
$_POST['cleanedPermaLinkArray[]']
$_POST['cleanedLinkStructureArray[]'];
Any help would be appreciated.
Kind regards,
Marnix