I am trying to send javascript array to php via ajax, but it is not sending, here is my code
var ArrayAmounts = new Array();
ArrayAmounts["P1"] = "16150";
$.ajax({
url:"myajax",
cache:'false',
type:'POST',
data:{Arr:ArrayAmounts},
success: function(data){
console.log(data);
},error: function(xhr, AjaxOptions, ThrownError){
ShowMessage(xhr.responseText);
}
});
but when I am making array like this:
var ArrayAmounts = new Array();
ArrayAmounts[0] = "16150";
it is passing the array, but I want the key as alphanumeric. please help.
objectif you want keys to be alphanumeric