<commit_before>
function getURLId() {
	var sPageURL = window.location.search.substring(1);
	var sParameterName = sPageURL.split('=');
	if (sParameterName[0] == 'id') {
		console.log(sParameterName[1]);
		var query_id = document.getElementById('title').innerHTML = sParameterName[1];
		
		return query_id;
	}
}

$(document).ready(function() {
	getShow();
});


function objectifyForm(formArray) {//serialize data function
  var returnArray = {};
  for (var i = 0; i < formArray.length; i++){
    returnArray[formArray[i]['name']] = formArray[i]['value'];
  }
  return returnArray;
}

// this is the id of the form
$("#searchForm").submit(function(e) {
	var formJsonObj = objectifyForm($("#searchForm").serializeArray());

	formJsonObj['verified'] = 1;
	formJsonObj['id'] = getURLId();
	console.log(formJsonObj);

	var url = env_variables.url;
	$.ajax({
	  url: url,
	  dataType: 'json',
	  type: 'POST',
	  data: JSON.stringify(formJsonObj),
	  success: function (data) {
	  		Materialize.toast('Verification successfully sent!', 4000);
	  },
	  error: function() {
	  	console.log('erorr');
	  }
	});
    e.preventDefault(); // avoid to execute the actual submit of the form.
});


function foo(id) {
	var el = $(id);
	if (el.attr('contenteditable') == 'true'){
		el.attr('contenteditable', 'false');
	} else {
		el.attr('contenteditable', 'true')
	}
}

function getShow() {
	var url = env_variables.url + '?id=' + getURLId();
	$.ajax({
	  url: url,
	  dataType: "json",
	  success: function (data) {
	  		var episode = data['episode'];
	  		$('#parent').val(episode['parent']);
	  		$('#name').val(episode['name']);
	  		$('#season').val(episode['season']);
	  		$('#episode').val(episode['episode']);
	  		$('#video_files').val(episode['video_files']);
	  		$('#subtitles').val(episode['subtitles']);
	  		$('#trash').val(episode['trash']);

	  		console.log(episode);
	  },
	  error: function() {
	  	console.log('erorr');
	  }
	});
}<commit_msg>Now the post and get functions work with changes done with the api.<commit_after>
function getURLId() {
	var sPageURL = window.location.search.substring(1);
	var sParameterName = sPageURL.split('=');
	if (sParameterName[0] == 'id') {
		console.log(sParameterName[1]);
		var query_id = document.getElementById('title').innerHTML = sParameterName[1];
		
		return query_id;
	}
}

$(document).ready(function() {
	getShow();
});


// this is the id of the form
$("#searchForm").submit(function(e) {
	var url = env_variables.url + 'verify/' + getURLId();
	$.ajax({
	  url: url,
	  type: 'POST',
	  success: function (data) {
	  		Materialize.toast('Verification successfully sent!', 4000);
	  },
	  error: function() {
	  	console.log('erorr');
	  }
	});
    e.preventDefault(); // avoid to execute the actual submit of the form.
});


function foo(id) {
	var el = $(id);
	if (el.attr('contenteditable') == 'true'){
		el.attr('contenteditable', 'false');
	} else {
		el.attr('contenteditable', 'true')
	}
}

function getShow() {
	var url = env_variables.url + getURLId();
	$.ajax({
	  url: url,
	  dataType: "json",
	  success: function (data) {
	  		$('#parent').val(data['parent']);
	  		$('#name').val(data['name']);
	  		$('#season').val(data['season']);
	  		$('#episode').val(data['episode']);
	  		$('#video_files').val(data['video_files']);
	  		$('#subtitles').val(data['subtitles']);
	  		$('#trash').val(data['trash']);

	  		console.log(data);
	  },
	  error: function() {
	  	console.log('erorr');
	  }
	});
}
{'fraction_non_alphanumeric': 0.2075036075036075, 'fraction_numerical': 0.005194805194805195, 'mean_word_length': 4.05985401459854, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5352163', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1221, 'n_words': 238}