/*
dojo.provide("IntelliFactory.WebServices");
dojo.require("jQuery");
*/


NETWebMethod = function(serviceURL, method, args, handler) {
    var methodURL = serviceURL + "/" + method; function error(xhr, err) {
        console.error("Error when calling NETWebMethod:", err, { methodURL: methodURL, arguments: args, status: xhr.status, statusText: xhr.statusText, responseText: xhr.responseText });
    }; 
    jQuery.ajax({ type: "POST", url: methodURL, data: dojo.toJson(args), contentType: "application/json;charset=utf-8", dataType: "json", success: function(x) { handler(x.d); }, error: error });
};


PostJSON = function(url, json, handler) {
    function error(xhr, err) {
        console.error("Error when calling PostJSON:", err, { url: url, json: json, status: xhr.status, statusText: xhr.statusText, responseText: xhr.responseText });
    };
    jQuery.ajax({ type: "POST", url: url, data: dojo.toJson(json), contentType: "application/json;charset=utf-8", dataType: "json", success: function(x) { handler(x.d) }, error: error });
};