Last active
August 29, 2015 14:07
-
-
Save user19/4949c6dedd625b01a067 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function xhrStart(method,url,data,requestHeader,callback){ | |
var xhr = new XMLHttpRequest(); | |
xhr.onload = function(){ | |
callback(xhr.response); | |
} | |
xhr.open(method,url); | |
if(requestHeader !== null) | |
for(key in requestHeader) | |
xhr.setRequestHeader(key,requestHeader[key]); | |
xhr.responseType = "document"; | |
xhr.send(data); | |
} | |
var workFinish = function(document){ | |
var n = Number(document.getElementsByClassName('status_numeric x-small')[0].innerHTML.slice(0,-3)); | |
if(n >= 2) | |
workStart(); | |
} | |
var workStart = function(){ | |
xhrStart('GET','http://uni.priget.com/s/app/income/income_exec.php',null,null,workFinish); | |
} | |
workStart(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment