Why jquery pjax is not defined in the js file, but it's defined in the console if i type $.pjax
function loadScript(url, callback) {
callback = (typeof callback != 'undefined') ? callback : {};
$.ajax({
type: "GET",
url: url,
success: callback,
dataType: "script",
cache: true,
});
}
$('document').ready(function() {
$.when(
loadScript('//cdnjs.cloudflare.com/ajax/libs/codemirror/5.10.0/codemirror.min.js'),
loadScript('//cdnjs.cloudflare.com/ajax/libs/jquery.pjax/1.9.6/jquery.pjax.min.js')
).done(function() {
$('.loading').hide().next().css({
'visibility': 'visible',
'overflow-y': 'auto',
});
console.log($.pjax() + ' ...');
});
});
it console this error: Uncaught TypeError: $.pjax is not a function