I'm working on a javascript function that when called will make a ajax request to a separate page. The separate page handles manipulating and displaying an array.
To display the list I use the function:
$('#pub-mod [name="userid"]').change(function() {
var usr = $('#pub-mod [name="userid"]').val();
if (usr != '') {
$.ajax({
url : 'ajax_admin_load_pubs.php',
data: {'action' : 'load_'+usr},
dataType : "text",
success : function(response) {
$('#pub-mod-list').html(response);
}
});
}
});
This function is working as intended, and if I place print_r($_GET); in the ajax file I have Array ( [action] => load_userid ) show up.
The function to edit the list looks like this:
function modify_pubs(action) {
$.ajax({
url : 'ajax_admin_load_pubs.php'
data: {'action' : action},
dataType : "text",
success : function(response) {
$('#pub-mod-list').html(response);
}
});
}
This function is not working as intended, and if I place print_r($_GET); in the ajax file I have Array ( [action] => load_load ) show up.
I've verified that action in the second function is returning the correct value, and at this point I'm kind of at a lost as to what could be wrong.
Any ideas?
Answers to comments thus far:
I'm calling modify_pubs from text links generated by the code used to display it. (i.e. <button onclick="modify_pubs(userid_c_up);">up</button>
The portion for "modify_pubs(userid_c_up)" was checked by just having it alert the value being passed.
Also, I expect to see Array ([action] => text_string_from_action) – Charles Smith 3 mins ago edit
Action is a text string that is underscore delimited to run separate portions of the ajax code.
modify_pubsfunction?<button onclick="modify_pubs(userid_c_up);">up</button>The portion for "modify_pubs(userid_c_up)" was checked by just having it alert the value being passed. Also, I expect to seeArray ([action] => text_string_from_action)