Add exams from exam156 to exam199
This commit is contained in:
1
exam172/include.inc.php
Normal file
1
exam172/include.inc.php
Normal file
@@ -0,0 +1 @@
|
||||
Hello!
|
||||
45
exam172/index.php
Normal file
45
exam172/index.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
//AJAX code
|
||||
function load(thediv, thefile){
|
||||
|
||||
//Ovde proveravamo da li browser podrzava objekat XMLHttpRequest, ako podrzava pravimo nov objekat, ako ne podrzava
|
||||
//tada se koristi alternativni pristup stvaranju objekta kroz ActiveXObject.
|
||||
|
||||
if (window.XMLHttpRequest){
|
||||
xml_http = new XMLHttpRequest();
|
||||
} else {
|
||||
xml_http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
|
||||
//kada se stanje objekta xml_http promeni funk ce se aktivirati
|
||||
//funkcija proverava da li je stanje objekta dostiglo readyState=4 sto znaci da je zahtev zavrsen
|
||||
//i da li je status HTTP odgovora 200 = 'OK'
|
||||
//responseText ili odgovor se postavlja kao html sadrzaj
|
||||
|
||||
xml_http.onreadystatechange = function() {
|
||||
if(xml_http.readyState == 4 && xml_http.status == 200){
|
||||
//mi kacimo sadrzaj u <div>
|
||||
document.getElementById(thediv).innerHTML = xml_http.responseText;
|
||||
}
|
||||
}
|
||||
//open salje HTTP zahtev, prvi parametar je metoda, drugi URL adresa na koju se salje, treci true znaci da se izvrsava asihrono
|
||||
//send samo za slanje http zahteva na server
|
||||
xml_http.open('GET',thefile, true);
|
||||
xml_http.send();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<input type="submit" onclick="load('anotherdiv','include.inc.php');">
|
||||
<div id="anotherdiv"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user