I am trying to make a Rest API call using Ajax (Post request). The API returns XML as response. I want to parse the response in my server side code and then pass the parsed value to client side, so that my presentation layer is not overwhelmed.
Can anyone suggest an effective way to parse the xml server side and then return the response to ajax call back function. Basically I am looking for a way to send the parsed value to my ajax call back function which would be executed when ajax status is successful.
Following is my ajax call
$('button[name=sendsms]').on("click", function(){
var button = $(this);
var form = button.parents('form:first');
var postData = form.serialize();
var formURL = form.attr("action");
$.post(formURL,{ data : postData, method : "ajax" }, function (data, status, response){
if(status == 'success'){
// Access the server side parsed data here
}
}, );
});
});