Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading jQuery UI with getScript
    text
    copied!<p>I am trying to build a widget which requires the person to load jQuery and jQuery.UI.</p> <p>Getting the jQuery to load is not a problem but adding ui the the header is just not working and I keep getting this error.</p> <pre><code>b is undefined [Break on this error] (function(b,c){function f(g){return!b(...NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106, </code></pre> <p>Here is the script in its simple form.</p> <pre><code>(function() { // Localize jQuery variable var jQuery; /******** Load jQuery if not present *********/ if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.4') { var script_tag = document.createElement('script'); script_tag.setAttribute("type", "text/javascript"); script_tag.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"); script_tag.onload = scriptLoadHandler; script_tag.onreadystatechange = function () { // Same thing but for IE if (this.readyState == 'complete' || this.readyState == 'loaded') { scriptLoadHandler(); } }; // Try to find the head, otherwise default to the documentElement (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag); } else { // The jQuery version on the window is the one we want to use jQuery = window.jQuery; main(); } /******** Called once jQuery has loaded ******/ function scriptLoadHandler() { // Restore $ and window.jQuery to their previous values and store the // new jQuery in our local jQuery variable jQuery = window.jQuery.noConflict(true); // Call our main function main(); } /******** Our main function ********/ function main() { // Add some validation here to make sure UI is not loaded etc... jQuery.getScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js'); jQuery(document).ready(function($) { var date = new Date(); var m = date.getMonth(), d = date.getDate(), y = date.getFullYear(); $('.datepicker').datepicker({minDate: new Date(y, m, d)}); /******* Load HTML *******/ var jsonp_url = "/search/form/%AFFILIATE_ID%/%FORM_TYPE%/"; $.getJSON(jsonp_url, function(data) { $('#my-widget').html(data); }); }); } })(); // We call our anonymous function immediately </code></pre> <p>Any ideas how I can resolve this ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload