(function(){
	var init = {};
    init.url = "http://1a558a7e.ngrok.io/";
	init.showIndicator = function(){
        $(document.body).append('<div class="preloader-indicator-overlay"><div class="preloader-indicator-modal"><span class="preloader preloader-white"></span></div></div>');
    }
    
	init.hideIndicator = function () {
        $('.preloader-indicator-overlay').remove();
    };

	init.demo = function(options){
    	alert(0)
  	}

  	init.ajax = function(o, data, type, callBack, load){
  		var url = o.url || o,
            type = o.type || "GET",
            data = o.data || (data || ""),
            dataType = o.dataType || "json",
            async = o.async || true,
            loading = o.load == null ? (load != undefined ? load : true) : o.load,
            contentType = o.contentType || "application/json";
        callBack = o.callBack || callBack;
        // url = url.length > 0 ? (url.indexOf("?") != -1 ? url+"&t="+Math.random() : url+"?t="+Math.random()) : "";
        // typeof callBack == "undefined" ? callBack = ajaxback : function(o) {};
        // if (loading) this.showIndicator();
        console.log(data)
        $.ajax({
            url: init.url+url,
            type: 'GET',
            data: data,
            contentType: contentType,
            dataType: this.dataType,
            jsonp: "callbackparam",
            cache: false,
            async:async,
            success: function(data) {
              callBack(data);
            },
            error: function(xml, status) {
                if (status == "error") {
                    callBack('失败')
                }
            },
            complete: function() {
                if (loading) {
                    init.hideIndicator();
                }
            }
        });
  	}
  	
  	window.init = init;
}())