I am calling a POST where I need to send request parameters and array in request body. Am I sending it correctly? For some reason, the call is returning 401 Unauthorized.
$.ajax({
type: "Post",
url: "https://myserver.com/WebServices/upms/giveCompanyDatasetDBInfo?personnelId=1234&projectId=80&companyId=3222&companyShortName=testNameSept1",
data: JSON.stringify(selectedRows) ,
async: true,
cache: false,
success: function(data) {
console.log("Inside success of giveStandardDatasetDBInfo endpoint");
console.log(data);
}
});
If you are wondering what is selectedRows
, it’s the following array which is obtained when you click get rows button in this JSfiddle:
[{
available: true,
boundindex: 1,
firstname: "Mayumi",
lastname: "Petersen",
price: 4.5,
productname: "Caffe Latte",
quantity: 10,
total: 45,
uid: 1,
uniqueid: "2527-22-22-30-262925",
visibleindex: 1
}, {
available: true,
boundindex: 3,
firstname: "Regina",
lastname: "Davolio",
price: 3,
productname: "Caffe Espresso",
quantity: 2,
total: 6,
uid: 3,
uniqueid: "2625-21-18-21-302517",
visibleindex: 3
}, {
available: true,
boundindex: 5,
firstname: "Antoni",
lastname: "Nodier",
price: 4.5,
productname: "Caffe Latte",
quantity: 4,
total: 18,
uid: 5,
uniqueid: "1722-19-21-21-291926",
visibleindex: 5
}, {
available: true,
boundindex: 7,
firstname: "Nancy",
lastname: "Nagase",
price: 4,
productname: "Peppermint Mocha Twist",
quantity: 1,
total: 4,
uid: 7,
uniqueid: "2820-23-31-17-222721",
visibleindex: 7
}, {
available: true,
boundindex: 9,
firstname: "Lars",
lastname: "Nagase",
price: 3.25,
productname: "Espresso con Panna",
quantity: 3,
total: 9.75,
uid: 9,
uniqueid: "2826-22-19-25-252329",
visibleindex: 9
}]