// Calling WebService Function for javascript
WebServiceObj.GetYourFunctionName(param1, param2, ..., onSucceeded, onFailed, userContext);
WebServiceObj.GetYourFunctionName(param1, param2, ..., onSucceeded, onFailed, userContext);
/**
* WebService onSuccess Callback function for AJAX.
* @param {Object} result Can be any types return from WebService Function.
* @param {String} userContext String can be pass into OnSucceeded or OnFailed Callback Function.
* @param {String} methodName The WebService Name you called.
*/
function OnSucceeded(result, userContext, methodName)
{
if (methodName == "GetSessionValue")
{
displayElement.innerHTML = "Current session state value: " + result;
}
}
/**
* WebService onFailed Callback function for AJAX.
* @param {Object} result The value retrun from WebService Function.
* @param {String} userContext Any String you want pass into callback functions.
* @param {String} methodName The WebService Function name you calling.
*/
function OnFailed(error, userContext, methodName)
{
var stackTrace = error.get_stackTrace();
var message = error.get_message();
var statusCode = error.get_statusCode();
var exceptionType = error.get_exceptionType();
var timedout = error.get_timedOut();
...
...
}
* WebService onFailed Callback function for AJAX.
* @param {Object} result The value retrun from WebService Function.
* @param {String} userContext Any String you want pass into callback functions.
* @param {String} methodName The WebService Function name you calling.
*/
function OnFailed(error, userContext, methodName)
{
var stackTrace = error.get_stackTrace();
var message = error.get_message();
var statusCode = error.get_statusCode();
var exceptionType = error.get_exceptionType();
var timedout = error.get_timedOut();
...
...
}
Related Links: