Hello All -
I want to dynamically build the parameters for the data key of an ajax call but I can't get it to won't work.
I've check my results with alert() and everything looks perfect but it still won't work.
Is it the way I'm quoting the different elements in the datalist?
Can someone see where I'm going wrong?
++++++++++++++++++++++++++++++++++++++++++++
function ajaxAction(vars)
{
var id = vars[0];
var table = vars[1];
var category = vars[2];
var action = vars[3];
var dataList = x = null;
x = 'action: ' + action + ', ';
x += 'rowid: ' + id + ', ';
x += 'table: ' + table + ', ';
x += 'category: ' + category;
dataList = '{ ' + x + ' }';
alert(dataList);
// the alert shown is correct:
//{ action: Delete, rowid: 20, table: tbl_attack_log, category: Guestbook }
$.ajax({
type: "POST",
url: "assets/ajax/backend_action.php",
data: dataList,
dataType: "json",
success: function(data) {
afterAction(data);
}
});
}