$(document).ready(function(){
    AjaxRequest = new AjaxRequest();
});
function AjaxRequest() {
    this.ExecuteGet = function(url, func, comp) {
        $.ajax({
            type: "GET",
            cache: false,
            async: true,
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            url: "AjaxEngine/" + url,
            success: function(Json) {
                if(Json) {
                    if(Json.Success != true) {
                        alert(Json.Message);
                    }else{
                        func(Json);
                    }
                }else{
                    alert("O servidor está temporariamente indisponível, Por favor, tente mais tarde.");
                }
               
            },complete: function() {
                comp();
            }
        });
    };
    this.ExecutePost = function(url, data, func) {
        alert(data);
        $.ajax({
            type: "POST",
            cache: false,
            async: true,
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            url: "AjaxEngine/" + url,
            data: data,
            success: function(ajaxResponseWrapper) {
                func(ajaxResponseWrapper);
            }
        });
    }
}
