I was trying to send an associative array of warnings and when a button is clicked it. It will pass id and type of warning and trigger collect function which stores them in tointo the array as key value pairs then. Then I want to send it to another page the. The problem is if it is simple array it will work when I call $_POST ['warn']; but if I change it to associative an associative array I will get error msg saying that warn is not defined this. This is my JS code -:
var warnings = [];
function collect(id,type){ warnings [id] = type;}
$('#but1').click (function (){
$.post ("url", {warn: warnings}function(r){alert (r);});
});
isIs there a way to send the associative array as key value pairs using AJAX to my php page and get the array using $_POST $_POST?
thanx,