I am using the jQuery ajax call like this:
$.ajax({
url: WEBSERVICE_URL,
type: "GET",
dataType: "application/json; charset=utf-8",
username: "admin", // Most SAP web services require credentials
password: "admin",
processData: false,
contentType: "application/json",
success: function() {
alert("success");
},
error: function() {
alert("ERROR");
},
});
Still the call is not going to web service. Everytime I am getting ERROR alert. Can somebody help me on this please?
Try using post for the method type, most webservices are secured and require transimssion using post and not Get
plus to help you debug the error and a response text to your error.
$.ajax({
url: WEBSERVICE_URL,
type: "POST", //This is what you should chage
dataType: "application/json; charset=utf-8",
username: "admin", // Most SAP web services require credentials
password: "admin",
processData: false,
contentType: "application/json",
success: function () {
alert("success");
},
error: function (xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
alert(xhr.status);
alert(xhr.responseText);
},
});