Board Thread:JS Development/@comment-5017871-20200111053231

I'm trying to pull information from a page using a JavaScript, but I have no idea where to go from where I am at the code. I borrowed this code from the UserTags and modified it a bit for my personal Wiki so I could get the edit count from the User's page and not the special EditCount. I feel like it's supposed to be a headhtml ordeal, but I'm confused on how to use it. Any help will be appreciated!

This is the code below.

//Ranks Go Here window.UserTagsJS.extensions.Ranks = { start: function(config, username) { var promise = $.ajax({			url: mw.util.wikiScript('api'),			data: {			   //Pull Edit Count on Userpage				action: 'parse',				format: 'json',				text: ,				headhtml: ,				prop: 'headhtml'				//disablepp: 1			},			dataType: 'json'		}).then(function(json) {		    var fun = $(json.headhtml.getElementsByClassName('contributions-details tally')); //Pulls Class Data		    var num = fun[0].textContent.replace(/\D/g,); //Stores Value			//var num = $(json.parse.text['*']).text.replace(/\D/g, );			if (num > 0 && num < 150) {			    return ['editor']; //Beginning tag for those who make more than 1 edit.			}			else if (num >= 150 && num < 5000) {				return ['proficient']; //Should give users Proficient Editor tag if over 150 Edits but under 5000 Edits.			}			else if(num >= 5000 && num < 7600) {			    return ['grand']; //Should give users Grand Master of All Things Bad tag if over 5000 Edits. }			else if(num > 7600) { return ['fail']; //The number I'm testing is under 7600. If it's over 7600, then it's pulling from the username I'm testing on and not the edit count. }			return null; });		return {			tags: {			   fail: { u: 'You Failed'},			    editor: { u: 'Wiki Editor'},				proficient: { u: 'Proficient Editor' },				grand: { u: 'Grand Master of All Things Bad' }			},			promise: promise		};	} }; window.UserTagsJS.modules.Ranks = true;  