handleman
11/14/2014 - 10:27 AM

function that executes Jquer.ajax to defined url and then launch handler function or return data recevied

function that executes Jquer.ajax to defined url and then launch handler function or return data recevied

var getRequest = function (dataToSend,url,handler) {
	if(!dataToSend){
		dataToSend = '';
	}
	$.ajax({
		type: 'GET',
		url: url,
		data:dataToSend,
		success: function(data) {
			if(typeof handler == 'function'){
				handler(data);
			} else{
				return data;
			}
		}
	});
};