$_POST doesn't reflect data being sent with jQuery post ajax

zRANDOMz

New Member
I'm using ajax/json to send values to a php function that would then display the data on the page. I'm sending two values \[code\]$hours\[/code\] and \[code\]$memberID\[/code\], except I seem to only be able to retrieve \[code\]$hours\[/code\] and not \[code\]$memberID\[/code\]. I ran the page through Firebug, on the javascript page the values for both variables are being read right before they're sent. In the PHP form, I ran multiple conditions/echo statements to print out both values except only \[code\]$hours\[/code\] is being displayed. Any ideas?PHP:\[code\]$result = array(); if(!empty($_POST['hours'])) { $result['type'] = "success"; $result['memberID'] = (int)$_POST['memberID']; $result['hours'] = (int)$_POST['hours']; $result = json_encode($result); echo $result; }\[/code\]Javascript:\[code\]var memberID = document.getElementById("member"+i); if(memberID && memberID.checked) { $.ajax({ type : 'post', datatype: 'json', url : 'hours_subtract.php', data : {hours : hours.value, memberID : memberID.value}, success: function(response) { if(response == 'success') { alert('Hours subtracted!'); } else { alert('Error!'); } } }); }\[/code\]Edit: If I run a \[code\]var_dump($_POST['memberID']);\[/code\], it prints out \[code\]NULL\[/code\]. If I run a \[code\]var_dump($_POST)\[/code\], it prints out \[code\]array(2) { ["hours"]=> string(1) "1" ["member3"]=> string(8) "5101813/" }\[/code\].
 
Top