大侠
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
636 B

/**XML请求工具 */
export default class XMLHttp{
/**XML 请求 */
static Request(url:string,Back:Function,ErrorBack?:Function){
let xhr: XMLHttpRequest = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) {
if (xhr.responseText.length > 0) {
Back(xhr.responseText)
} else {
Back(null)
}
}
}
xhr.onerror = () => {
Back(null)
}
xhr.send();
}
}