Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LoadMobs(dung){
- var xhr;
- if (window.XMLHttpRequest) {
- xhr = new XMLHttpRequest();
- } else if (window.ActiveXObject) {
- xhr = new ActiveXObject("Msxml2.XMLHTTP");
- } else {
- throw new Error("Ajax is not supported by this browser");
- }
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- if (xhr.status == 200 && xhr.status < 300) {
- // get mobs from PHP
- setTempMobs(JSON.parse(xhr.responseText));
- alert(tmpMs[0].NAME);
- }
- }
- }
- xhr.open('POST', 'loadmobs.php');
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xhr.send("dung=" + dung);
- }
- function setTempMobs(mss){
- tmpMs = mss;
- }
- LoadMobs(currDungBgIndex);
- alert(tmpMs[0].NAME);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement