Skip to main content

Tedshd's Dev note

Category: Jsonp

JavaScript - Dynamic Load script || JSONP Callback

# JavaScript - Dynamic Load script || JSONP Callback ## Intro Sometimes we need dynamic load script or handle jsonp callback And we need handle script onload or jsonp callback onload or something error ## How to do? Use onload, onerror method ## Code if (typeof UTIL == 'undefined' || !UTIL) { var UTIL = {}; } UTIL.createEl = { get: function(sTag, oAttr, handleOnLoad, handleError) { var el = document. ...