jquery async laden error
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var async = async || [];
(function () {
var done = false;
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0] || document.documentElement;
script.src = '<?=HTML_ROOT?>js/jquery.js';
script.type = 'text/javascript';
script.async = true;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
done = true;
console.log('jquery main script is ready');
// Process async variable
//var async = async || [];
while(async.length) { // there is some syncing to be done
var obj = async.shift();
if (obj[0] =="ready") {
$(obj[1]);
}else if (obj[0] =="load"){
$(window).load(obj[1]);
}
}
async = {
push: function(param){
if (param[0] =="ready") {
$(param[1]);
}else if (param[0] =="load"){
$(window).load(param[1]);
}
}
};
// End of processing
script.onload = script.onreadystatechange = null;
if (head && script.parentNode) {
head.removeChild(script);
}
}
};
head.insertBefore(script, head.firstChild);
})();
(function () {
var done = false;
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0] || document.documentElement;
script.src = '<?=HTML_ROOT?>js/jquery.js';
script.type = 'text/javascript';
script.async = true;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
done = true;
console.log('jquery main script is ready');
// Process async variable
//var async = async || [];
while(async.length) { // there is some syncing to be done
var obj = async.shift();
if (obj[0] =="ready") {
$(obj[1]);
}else if (obj[0] =="load"){
$(window).load(obj[1]);
}
}
async = {
push: function(param){
if (param[0] =="ready") {
$(param[1]);
}else if (param[0] =="load"){
$(window).load(param[1]);
}
}
};
// End of processing
script.onload = script.onreadystatechange = null;
if (head && script.parentNode) {
head.removeChild(script);
}
}
};
head.insertBefore(script, head.firstChild);
})();
foutmelding
Quote:
nl:2172 Uncaught TypeError: $ is not a function
at HTMLScriptElement.script.onload.script.onreadystatechange (nl:2172)
script.onload.script.onreadystatechange @ nl:2172
at HTMLScriptElement.script.onload.script.onreadystatechange (nl:2172)
script.onload.script.onreadystatechange @ nl:2172
regel 2172: $(obj[1]);
wat is hier fout aan? De url klopt gewoon , die kan ik openen.
Check je console eens.
Verander function regel 2 is in $(function() { });
Quote:
Check je console eens.
Dit is het enige wat ik al meldde in de console:
Quote:
nl:2172 Uncaught TypeError: $ is not a function
at HTMLScriptElement.script.onload.script.onreadystatechange (nl:2172)
script.onload.script.onreadystatechange @ nl:2172
regel 2172: $(obj[1]);
at HTMLScriptElement.script.onload.script.onreadystatechange (nl:2172)
script.onload.script.onreadystatechange @ nl:2172
regel 2172: $(obj[1]);
Als ik $( naar jQuery( verander doet hij het wel, maar waarom?
de hele code is:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
var async = async || [];
(function () {
var done = false;
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0] || document.documentElement;
script.src = 'https://code.jquery.com/jquery-1.12.4.min.js';
script.type = 'text/javascript';
script.async = true;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
done = true;
console.log('jquery main script is ready');
// Process async variable
//var async = async || [];
while(async.length) { // there is some syncing to be done
var obj = async.shift();
if (obj[0] =="ready") {
jQuery(obj[1]);
}else if (obj[0] =="load"){
jQuery(window).load(obj[1]);
}
}
async = {
push: function(param){
if (param[0] =="ready") {
jQuery(param[1]);
}else if (param[0] =="load"){
jQuery(window).load(param[1]);
}
}
};
// End of processing
script.onload = script.onreadystatechange = null;
if (head && script.parentNode) {
head.removeChild(script);
}
}
};
head.insertBefore(script, head.firstChild);
})();
async.push(["ready",function (){
jQuery.when(
jQuery.getScript( "<?=HTML_ROOT?>js/plupload.full.min.js?ver=2.1.8" ),
jQuery.getScript( "<?=HTML_ROOT?>js/countdown.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/sticky_message.js" ),
jQuery.getScript( "https://maps.googleapis.com/maps/api/js?key=AIzaSyBUf_D5xxq3wHgTm8-HWm1kCdBx6xkIBlo" ),
jQuery.getScript( "<?=HTML_ROOT?>js/scripts.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/functions.js?ver=3.0" ),
jQuery.getScript( "<?=HTML_ROOT?>js/bootstrap.min.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/core.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/widget.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/mouse.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/sortable.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/slider.min.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/underscore.min.js?ver=1.8.3" ),
jQuery.getScript( "<?=HTML_ROOT?>js/wp-util.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/docdirect_functions.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/user_profile.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/moment.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/bookings.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/parallax.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/owl.carousel.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/prettyPhoto.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/datetimepicker.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/appear.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/countTo.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/modernizr-2.8.3-respond-1.4.2.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/chosen.jquery.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/wp-embed.min.js?ver=4.8.1" ),
//jQuery.getScript( "http://maps.googleapis.com/maps/api/js?key=AIzaSyA2ZZ8qvEXhdLes2j90MoIcAkyHFCq_PhA&libraries=places&ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/markerclusterer.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/infobox.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/map.js?time=<?=time()?>" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/oms.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/docdir_maps.js?time=<?=time()?>" ),
jQuery.getScript( "<?=HTML_ROOT?>js/position.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/menu.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/wp-a11y.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/autocomplete.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/gmap3.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/jRate.js?ver=4.8.2" ),
jQuery.getScript( "<?=HTML_ROOT?>js/utils.min.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/editor.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/tinymce/tinymce.min.js?ver=4603-20170530" ),
jQuery.Deferred(function( deferred ){
jQuery( deferred.resolve );
})
).done(function(){
alert('k');
async.push(["ready", function(){
alert('k');
});
}]); // einde push ready
(function () {
var done = false;
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0] || document.documentElement;
script.src = 'https://code.jquery.com/jquery-1.12.4.min.js';
script.type = 'text/javascript';
script.async = true;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
done = true;
console.log('jquery main script is ready');
// Process async variable
//var async = async || [];
while(async.length) { // there is some syncing to be done
var obj = async.shift();
if (obj[0] =="ready") {
jQuery(obj[1]);
}else if (obj[0] =="load"){
jQuery(window).load(obj[1]);
}
}
async = {
push: function(param){
if (param[0] =="ready") {
jQuery(param[1]);
}else if (param[0] =="load"){
jQuery(window).load(param[1]);
}
}
};
// End of processing
script.onload = script.onreadystatechange = null;
if (head && script.parentNode) {
head.removeChild(script);
}
}
};
head.insertBefore(script, head.firstChild);
})();
async.push(["ready",function (){
jQuery.when(
jQuery.getScript( "<?=HTML_ROOT?>js/plupload.full.min.js?ver=2.1.8" ),
jQuery.getScript( "<?=HTML_ROOT?>js/countdown.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/sticky_message.js" ),
jQuery.getScript( "https://maps.googleapis.com/maps/api/js?key=AIzaSyBUf_D5xxq3wHgTm8-HWm1kCdBx6xkIBlo" ),
jQuery.getScript( "<?=HTML_ROOT?>js/scripts.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/functions.js?ver=3.0" ),
jQuery.getScript( "<?=HTML_ROOT?>js/bootstrap.min.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/core.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/widget.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/mouse.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/sortable.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/slider.min.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/underscore.min.js?ver=1.8.3" ),
jQuery.getScript( "<?=HTML_ROOT?>js/wp-util.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/docdirect_functions.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/user_profile.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/moment.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/bookings.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/parallax.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/owl.carousel.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/prettyPhoto.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/datetimepicker.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/appear.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/countTo.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/modernizr-2.8.3-respond-1.4.2.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/chosen.jquery.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/wp-embed.min.js?ver=4.8.1" ),
//jQuery.getScript( "http://maps.googleapis.com/maps/api/js?key=AIzaSyA2ZZ8qvEXhdLes2j90MoIcAkyHFCq_PhA&libraries=places&ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/markerclusterer.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/infobox.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/map.js?time=<?=time()?>" ),
jQuery.getScript( "<?=HTML_ROOT?>js/map/oms.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/docdir_maps.js?time=<?=time()?>" ),
jQuery.getScript( "<?=HTML_ROOT?>js/position.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/menu.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/wp-a11y.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/autocomplete.min.js?ver=1.11.4" ),
jQuery.getScript( "<?=HTML_ROOT?>js/gmap3.min.js?ver=4.8.1" ),
jQuery.getScript( "<?=HTML_ROOT?>js/jRate.js?ver=4.8.2" ),
jQuery.getScript( "<?=HTML_ROOT?>js/utils.min.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/editor.js" ),
jQuery.getScript( "<?=HTML_ROOT?>js/tinymce/tinymce.min.js?ver=4603-20170530" ),
jQuery.Deferred(function( deferred ){
jQuery( deferred.resolve );
})
).done(function(){
alert('k');
async.push(["ready", function(){
alert('k');
});
}]); // einde push ready
maar in de console blijft hij hangen bij:
js/tinymce/tinymce.min.js?ver=4603-20170530
en geen console errors en geen alert('l')
Toevoeging op 10/12/2017 15:00:45:
@joop overmaat:
Quote:
Verander function regel 2 is in $(function() { });
ik krijg dan
Uncaught SyntaxError: Unexpected token }
Toevoeging op 10/12/2017 15:02:06:
Verder geeft de console gewoon:
console.log('jquery main script is ready');
dat word geprint in de console
Gewijzigd op 10/12/2017 14:58:54 door Daniel van Seggelen
Dus, in jQuery-code laad je de jQuery-library in? :s
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
jQuery.Deferred(function( deferred ){
jQuery( deferred.resolve );
})
).done(function(){
alert('k');
async.push(["ready", function(){
alert('k');
});
jQuery( deferred.resolve );
})
).done(function(){
alert('k');
async.push(["ready", function(){
alert('k');
});
k alert hij dus niet
Toevoeging op 10/12/2017 17:00:00:
UPDATE
Ik heb lokaal jquery-1.12.4.min.js gealden en nu kan ik wel $( gebruiken, maar de rest werkt nog hetzelde
Gewijzigd op 10/12/2017 16:48:20 door Daniel van Seggelen
Jij laadt dus twee keer een Jquery library in? not good, volgens mij heb je die code zelf in de jquery .ready() functie geplakt maar dat gaat in dit geval natuurlijk niet werken.