I've looked at several other suggestions on this issue but for some reason my data is not being posted. Here is the relevant section of my code:
<input type="button" id="map_submit" value="Map Selection" />
<?php var_dump($_POST); ?> // display the posted variables
and
<script type="text/javascript">
$(document).ready(function(){
$('#map_submit').click(function(){
/* this part is from the slickgrid plugin, in which
* selectedData is an array that I want to post to the page
* and read via php
*/
var selectedData = [], selectedIndexes;
selectedIndexes = grid.getSelectedRows();
jQuery.each(selectedIndexes, function (index, value) {
selectedData.push(grid.getData()[value]);
});
$.post("mapper.php", {dataArray: selectedData});
});
});
</script>
From what I've seen from other questions, $.post
should work. But, when I click the button, nothing is shown from the var_dump. As a sanity check, if I add this to the javascript:
for (var i = 0; i < selectedData.length; i++) {
document.write(selectedData[i].questionID + "<br />");
}
it will print the questionID
values I selected in the grid (of course to a newly blank page).