How can I use XMLHttpRequest on the mobile extension?

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
    if(this.readyState == 4 && this.status == 200) {
        ...
}
xhr.open("POST", "{XML URL}", true);
xhr.send();

It’s Javascript code
Is there any problem here too?