-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (20 loc) · 687 Bytes
/
script.js
File metadata and controls
23 lines (20 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
window.onload = function() {
var results = document.getElementById("messages");
var button = document.getElementById("refresh");
/*Output the result of the ajax request*/
function successFunction(res) {
results.innerHTML = res.responseText;
}
/*AJAX request to refresh content for the user without refreshing the page*/
button.addEventListener("click", function() {
new Ajax.Request("mail.php", {
onSuccess : successFunction,
method : "post"
});
});
/*Load the content for the user on page load*/
new Ajax.Request("mail.php", {
onSuccess : successFunction,
method : "post"
});
}