Last active
October 27, 2017 10:06
-
-
Save TechNinjaWeb/21d3e68de6b59eecd76e4c0269615055 to your computer and use it in GitHub Desktop.
Get the 500 Unit Group NOC codes from the Canadian Government site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires jQuery (which is loaded on the page) | |
// Resource: http://www.cic.gc.ca/english/immigrate/skilled/noc.asp | |
// Ajax function that after successful run will return | |
// an array of all 500 unit group noc codes | |
// using the code as an index key | |
function GetAllNocCodes() | |
{ | |
return new Promise((resolve, reject) => | |
$.ajax({method: 'get', url: 'http://www.cic.gc.ca/english/immigrate/skilled/noc.asp', success: function(res){ | |
resolve(Array.prototype.slice.call($(res).find('#noc tr')).map(el=>({ [el.cells[0].innerText]: Array.prototype.slice.call(el.cells).map(c=>c.innerText) }))) | |
}}) | |
) | |
} | |
// IMPLEMENTATION | |
GetAllNocCodes().then( | |
data=> console.log("Your data, sir --->", data) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment