/**
 * @author hedgehog
 */

//	@import com.hedgehoglab.events.EventDelegator;

function BaseService(scope){
    EventDelegator.call(this,scope);
	
    this.request=function(options){
        $.ajax( {
            url:options.uri,
            data: $.toJSON(options.data),
            type: options.type,
            processData: false,
            timeout: 10000,
			cache: false,
            dataType: "json",  // not "json" we'll parse
            contentType:"application/json",
			async:(options.async!=null)?options.async:true
            ,success:function(res){
                options.callback(res);
            },
            error:function(e) {
                options.callback(null);
                return;
            }
        });
    };
};
