/
fn-a-list-0.php
executable file
·36 lines (34 loc) · 1.11 KB
/
fn-a-list-0.php
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
<?php
function fnalist0($movieid, $i){
//define new content of list column
$tolist = 0;
return '
<div class="first_div">
<!-- THIS BUTTON CALLS AJAX SCRIPT -->
<button id="showAjax" onclick="showAjaxStuff_'.$i.'();">Entfernen</button>
</div>
<div class="second_div" id="ajax_auto_'.$i.'">
<!-- AJAX CONTENT WILL BE LOADED INTO THIS DIV -->
</div>
<script type="text/javascript">
function showAjaxStuff_'.$i.'() {
if (window.XMLHttpRequest) {
// MODERN BROWSERS
xmlhttp = new XMLHttpRequest();
} else {
// VERY OLD BROWSERS
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
// IF THE AJAX CALL IS SUCCESSFULL
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("ajax_auto_'.$i.'").innerHTML = xmlhttp.responseText;
}
};
// CALLING THE PHP FILE
xmlhttp.open("GET","ajax-code.php?movieid='.$movieid.'&tolist='.$tolist.'");
xmlhttp.send();
}
</script>';
}
?>