-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsemanticweblog.js
44 lines (40 loc) · 1.73 KB
/
semanticweblog.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// @author Benjamin Birkenhake <benjaminbirkenhake.org>
// @package semanticweblog
// @copyright creative commons by-sa
function semanticweblog_send_assoc(baseurl){
// Create all necessary Variables
var term1 = '';
var atid = '';
var term2 = '';
var target = 'result';
var url = '/association/add';
var method = 'GET';
var append = true;
term1 = document.getElementById('edit-role1-ajax').value;
atid = document.getElementById('edit-atid-ajax').value;
term2 = document.getElementById('edit-role2-ajax').value;
url += '/' + term1 + '/' + atid + '/' + term2;
url = baseurl + url;
//alert (url);
if (document.getElementById) { // Only "document.getElementById" Browsers are allowed beyond here
// Browsergate: IE uses ActiveX, all other can go
var http_request = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
}//if
http_request.onreadystatechange =
function() {
if ((http_request.readyState == 4) && (http_request.status == 200)) {
if(append) {
document.getElementById(target).innerHTML += "<br/>"+http_request.responseText; // Attach the Result
}else{
document.getElementById(target).innerHTML = http_request.responseText; // Or Replace the Result
}
document.getElementById(target).scrollTop = document.getElementById(target).scrollHeight;
}// if
}//function
;
http_request.open(method,url,true); // Get the data, which file?, loading asynchronously is true
http_request.send(null); // Es werden keine Daten transferiert, darum
// The two Term fields are being cleared
document.getElementById('edit-role1-ajax').value = '';
document.getElementById('edit-role2-ajax').value = '';
}//function