-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobserverPage.js
More file actions
23 lines (21 loc) · 821 Bytes
/
Copy pathobserverPage.js
File metadata and controls
23 lines (21 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$.ajax({
url: "http://ec2-3-209-137-117.compute-1.amazonaws.com/campaignsAll/",
type: 'GET',
data: {},
async: true,
success: function (data) {
var tableBody = "";
for (campaign of data){
tableBody += "<tr> <td>" + campaign.campaignID + "</td><td>" + campaign.count + "</td><td onclick='joinCampaign(this)' style='cursor: pointer'>*JOIN*</td></tr>";
}
document.getElementsByTagName("table")[0].getElementsByTagName("tbody")[0].innerHTML = tableBody;
},
error: function(data) {
console.log("Failed to get all campaign info");
}
});
function joinCampaign(element){
var campaign = element.parentElement.getElementsByTagName('td')[0].innerText;
Cookies.set('campaignID', campaign);
window.location.href = "campaignPage.html";
}