Skip to content

Instantly share code, notes, and snippets.

@davecra
Created July 3, 2017 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davecra/9b4a35cc3a32381dd3e27c5bea086a9a to your computer and use it in GitHub Desktop.
Save davecra/9b4a35cc3a32381dd3e27c5bea086a9a to your computer and use it in GitHub Desktop.
Helper function to call a web service
// Helper function to call the web service controller
app.makeAjaxCall = function (command, params, callback, error) {
var dataToPassToService = {
Command: command,
Params: params
};
$.ajax({
url: '../../api/WebService',
type: 'POST',
data: JSON.stringify(dataToPassToService),
contentType: 'application/json;charset=utf-8'
}).done(function (data) {
callback(data);
}).fail(function (status) {
error(status);
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment