I can work around this problem with some extra code but would very much like to know why the following code does not work.
The first bit of code responds to a click ( I have about 6 check boxes) and returns a string value of id = "discover_ID" from statement var id = $(this).val(); I can verify this with an alert (id) statement.
$(document).ready(function() {
$(".chk").click(function() {
var val = ($(this).prop("checked") == true) ? 1 : 0;
var id = $(this).val();
setPhaseID(id);
});
});
The code for setPhaseID is shown next which just sets a $_SESSION variable, $_SESSION (id) using a jQuery ajax call.
function setPhaseID(id) {
$.ajax({
type : "POST",
async : true,
cache : false,
timeout : 5000, // sets timeout to 10 seconds
url : 'resources/library/setsession.php',
data : {
id : '1'
},
success : function(data) {
}
});
}
Now this does not appear to work however I can get the code will work if I implicity force the data to be:
data :{
'discover_ID': '1';
}