Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
JQuery Ajax POST method returning bad request
-
I’m currently having an issue on my following code, POST request is returning “Bad Request” error.
function UpdateOrderStatus(){
var domainName = "http://xxxxxx.xxxxxx.com/xxxx.xxxx.xxxxx/1_1/MainService.svc/webapi/UpdateOrderStatus"; var orderData = { "wsCodeCrypt" : "xxx", "caUid" : "xxx", "caPwd" : "xxx", "slsDoc" : "SO", "slsRef" : "00001", "status" : "pending" }; $.ajax({ url: domainName, method: "POST", data: orderData, cache: false, dataType: "xml", success: function(xml) { console.log(xml); }, error: function( xhr, status, errorThrown ) { console.log( "Error: " + errorThrown ); console.log( "Status: " + status ); } });
}
The code works if I use the full URL and ditch the entire “data: orderData” option. Anyone knows why this is the case?
-
@AspiringWizard At first glance if it works by passing the data on the URL I would say you’re looking into a GET request rather than a POST.