I'm setting up a page where our staff can view a list of items that should be on the shelf and then confirm if the items are there, or send in an alert if there's a problem.
I'm trying to create one function for each situation (item present, item not present, information incorrect) where each function will pass the correct parameters for that situation to a generic function which will make the actual ajax request.
This function is triggered by a button click (when the item is present and correct) and it logs the data correctly:
function log (rec_id,offset) { console.log("On Shelf \r\nRecord_Id: "+rec_id+"\r\nOffset: "+offset); var rdata =[]; rdata['id'] = rec_id; rdata['status'] = 1; rdata['branch'] = $("#branch").val(); rdata['loc_code'] = $("#location_code").val(); console.log("log function"); console.log(rdata); log_item(rec_id,offset,rdata); } this is what is output to the log:
[id: 1833049, status: 1, branch: "1", loc_code: "mnlp"] the log_item function makes the ajax request
function log_item(rec_id, offset, rdata) { console.log("Logging Item: i"+rec_id+"a"); console.log("log_item function"); console.log(rdata); $.ajax({ url: 'logItem.php', data: rdata }).done(function(response){ console.log(response); $("#form").foundation('close'); }); } It too logs the data correctly
[id: 1833049, status: 1, branch: "1", loc_code: "mnlp"] But when I view the requests sent, these parameters are not getting passed in request.