01.
function
beginsTest() {
02.
$ = jQuery.noConflict();
03.
04.
$.each($(
'.test-urls > div'
),
function
(index, value) {
05.
url = $(
this
).data(
'url'
);
06.
07.
if
(!$(
this
).find(
'h4'
).length) {
08.
$(
this
).append(
'<h4 style="height: 60px;">'
+url+
'</h4>'
);
09.
}
10.
11.
$.when(ajaxGetUrl(url, $(
this
)))
12.
.then(ajaxGetUrl(url, $(
this
)))
13.
.then(ajaxGetUrl(url, $(
this
)));
14.
});
15.
}
16.
17.
18.
function
ajaxGetUrl(url, thisobj) {
19.
ajaxTime =
new
Date().getTime();
20.
21.
$.ajax({
22.
url: url,
23.
type:
'GET'
,
24.
async:
false
25.
}).done(
function
() {
26.
totalTime =
new
Date().getTime()-ajaxTime;
27.
thisobj.append(
'<p>'
+totalTime+
'</p>'
);
28.
29.
delete
ajaxTime;
30.
delete
totalTime;
31.
});
32.
}
33.
34.
35.
function
resetTest() {
36.
$(
'.test-urls > div'
).html(
''
);
37.
}
38.
39.
40.
jQuery(
function
($) {
41.
42.
});