-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
26 lines (26 loc) · 798 Bytes
/
popup.js
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
$("#checkPage").click(function(){
var scores = [];
var urls = ['https://morning-harbor-96808.herokuapp.com', 'https://desolate-bastion-86556.herokuapp.com', 'https://secure-basin-62593.herokuapp.com']
$(urls).each(function() {
$.ajax({
type: 'POST',
url: this,
dataType: 'json',
data: $('#marlowe').serialize(),
success: function (data) {
scores.push(Math.round(data.objectivity * 100));
if (scores.length == urls.length) {
sum = 0;
for(var i = 0, len = scores.length; i < len; i++) {
sum += scores[i];
}
$("#resp").html("<h3>" + sum/2 + "% objective</h3>");
}
},
beforeSend:function(){
$("#resp").html("Loading...")
}
});
});
return false;
});