Thursday, October 24, 2013

Calling a function inside a function asynchronously using JQuery

var Test;
$(function () {

    var ServicePath = rootPath + "Services/TestService.asmx/";

    var ajxcalls = function (methodname, param, success, error) {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            cache: false,
            async: false,
            url: ServicePath + methodname,
            data: param,
            dataType: 'json',
            success: success,
            error: error
        });
    };

    Test = {
        Init: function () {
            Test.TestCheck();
        },
        TestCheck: function () {
            var isActive = false;
            var par = JSON2.stringify({ ParameterValue: value });
            ajxcall("TestIsActive", par, function (data) { isActive = data.d; }, function () { Alert('Error'); });
            Alert(isActive);
        }
    };
    Test.Init();
});


No comments:

Post a Comment