Here is simple code snippet to add authorization¬†header in an ajax¬†call:   $.ajax({ url: your URL, type: ‘GET’, dataType: ‘json’, headers: { ‘Authorization’: ‘Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJEdTFPeTBJaXh0Sy1fLU8za1FIR2pTekllRC11c1czVEc5MkVWZVJhLW5RIn0.eyJqdGkiOiI2YzgwZWUzYi01ZjZmLTRjZDUtYjJiMC1kNjFlZjgxMGIzY2MiLCJleHAiOjE1MTMwMDc3NDIsIm5iZiI6MCwiaWF0IjoxNTEzMDA3NDQyLCJpc3MiOiJodHRwOi8vYXV0aGRldjo4MDgwL2F1dGgvcmVhbG1zL1NESUVQIiwiYXVkIjoic2VjdXJpdHktYWRtaW4tY29uc29sZSIsInN1YiI6ImFjNTViMGZiLWFjZDgtNGQ2ZC1iZDg2LWJkNWZkMjQ5MDg5YiIsInR5cCI6IkJlYXJlciIsImF6cCI6InNlY3VyaXR5LWFkbWluLWNvbnNvbGUiLCJub25jZSI6IjU3ZTE3MTNhLWU3ZWQtNDFlMi04N2YzLThhYWU1YzU5NjkwYyIsImF1dGhfdGltZSI6MTUxMzAwNTg2OSwic2Vzc2lvbl9zdGF0ZSI6IjhlYzZjZDQ2LTE3YzctNDZjOS05N2UwLTQ5MGQ2ZTlhM2E3ZiIsImFjciI6IjAiLCJhbGxvd2VkLW9yaWdpbnMiOltdLCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiU0RJIEFkbWluIiwicHJlZmVycmVkX3VzZXJuYW1lIjoic2RpYWRtaW4iLCJnaXZlbl9uYW1lIjoiU0RJIiwiZmFtaWx5X25hbWUiOiJBZG1pbiIsImVtYWlsIjoic2RpYWRtaW5Ac21hcnRkZXN0aW5hdGlvbnMuY29tIn0.T8cRQTACjcT6xNWrPY7NIu6lwSliSoyR2WOf8CK6fA_lRoFmzwOddX-1oOf6WIGMVgrAROl-TVHW2wu3z9oW2CAYoBNeRSq5Cv6Bqhaf7KOaG8dpD4Ck0mwLAIhG77x4Y8wPAms5h-BzzWrpS8pM3J8Uda8O_t4cvsVuOx0bwGrBUVebmOBJbVlY2N6_iU7GQ6MRjLrDFiuiNPklERHS44V_622l4IfsyKdnWb_u9B5KuqZt9pDluvjfNG6B2xxsXfJjTmuSHWKPkPRXWGSx87fXBFLW1sZH6MNNpndsBLrxOPiN5PPYwxLeCTu1A_UEWgnecUG6uZJJtc9iJq4dLA’ }, contentType: ‘application/json; charset=utf-8’, success: function (result) { // CallBack(result); }, error: function (error) { } });

Read More →

Got a good code on web to dynamically load JS or CSS file function loadjscssfile(filename, filetype){ if (filetype==”js”){ //if filename is a external JavaScript file var fileref=document.createElement(‘script’) fileref.setAttribute(“type”,”text/javascript”) fileref.setAttribute(“src”, filename) } else if (filetype==”css”){ //if filename is an external CSS file var fileref=document.createElement(“link”) fileref.setAttribute(“rel”, “stylesheet”) fileref.setAttribute(“type”, “text/css”) fileref.setAttribute(“href”, filename) } if (typeof fileref!=”undefined”) document.getElementsByTagName(“head”)[0].appendChild(fileref) } […]

Read More →