I am making a call in jquery ajax and while the same code when defining the ajax properties 'from scratch' works, when setting the same values in a javascript object and then define the ajax request with the properties of the object respectively in the server i can't access them. While this works:
var onsuccess =function (data){
console.log(data)
makeArchiveRequest();
}
var onerror = function (data){
console.log(data)
}
$.ajax({
url: 'makeDBEntry/archive',
data: formData,
contentType: false,
processData: false,
type: "POST",
success: function(data){
onsuccess(data)
},
error:function (data) {
onerror(data);
}
});
this doesn't work :
var req = {
type :"POST",
data : formData,
url : 'makeDBEntry/archive',
contentType: false,
processData: false,
};
$.ajax({
url: req["url"],
data: req["data"],
contentType: req["data"],
processData: req["processData"],
type: req["type"],
success: function(data){
onsuccess(data)
},
error:function (data) {
onerror(data);
}
});
I just cant figure out what I am doing wrong;