<commit_before>var treeURL = "https://data.illinois.gov/resource/dzge-uybj.json"
var appToken = "<KEY>";

/*
* Creates 
*/
function createRequestURL(baseUrl, query){
	var url = baseUrl;
	var queries = [];
		queries.push('$$app_token' + '=' + appToken);
	for(var tag in query){
		if(query.hasOwnProperty(tag)){
			queries.push(tag + '=' + query[tag]);
		}
	}
	url += '?' + queries.join('&');
	return url;
}

function getTrees(){
	$.ajax({
		url: treesAPIUrl,
		method: "GET",
		dataType: "json",
		data: {
			"$limit": 5,
			"tree_species": "Acer rubrum",
			"$$app_token": appToken
		},
		success: function(data, status, jqxhr){
			console.log("Received: ", data);
			handleTreeData(data.data);
		},
		error: function(jqxhr, status, error){
			console.log("Critical Error. RIP.");
		}
	});
}

function handleTreeData(data){
	//8 references "tree_species"
	console.log(data[25][8]);
}

//Links and Documentation at End: A


function getTreesWithLimit(){
	var query = {
		'$limit': 5,
		'$offset': 3
	}
	var request = createRequestURL(treesAPIUrl, query);
	console.log(request);
}

//ENDNOTES

/* Section A
* Use $.param(data) to convert simple tag queries to URLs: http://stackoverflow.com/questions/3308846/serialize-object-to-query-string-in-javascript-jquery
* Loop Over JSON Tags: http://stackoverflow.com/questions/10352840/loop-through-json-object
*/<commit_msg>Created call structure, moved away from createRequestURL()<commit_after>var treeURL = "https://data.illinois.gov/resource/dzge-uybj.json"
var appToken = "<KEY>";

/*
* Creates 
*/
function createRequestURL(baseUrl, query){
	var url = baseUrl;
	var queries = [];
		queries.push('$$app_token' + '=' + appToken);
	for(var tag in query){
		if(query.hasOwnProperty(tag)){
			queries.push(tag + '=' + query[tag]);
		}
	}
	url += '?' + queries.join('&');
	return url;
}

function getTrees(query){
	query['$$app_token'] = appToken;
	$.ajax({
		url: treeURL,
		method: "GET",
		dataType: "json",
		data: query,
		success: function(data, status, jqxhr){
			console.log("Received: ", data);
			handleTreeData(data.data);
		},
		error: function(jqxhr, status, error){
			console.log("Critical Error. RIP.");
		}
	});
}

function handleTreeData(data){
	console.log(data);
}

getTrees({
	"$limit": 5,
	"tree_species": "Acer rubrum"
});

{'fraction_non_alphanumeric': 0.18435998252512015, 'fraction_numerical': 0.010048055919615552, 'mean_word_length': 4.276497695852535, 'pattern_counts': {'":': 5, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1302795', 'n_tokens_mistral': 908, 'n_tokens_neox': 829, 'n_words': 172}