How to use XMLHttpRequest in ionic

Actually I tired to send headers but am not able to do

var data = new FormData();

data.append("email", "");

var xhr = new XMLHttpRequest();

xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {

if (this.readyState === 4) {



});"POST", "");

xhr.setRequestHeader("Content-Type", "application/json");

xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");



Please help me out


Angular has the HttpClient which does this for you.

Thanks for your response
Actually i want to try send header but nothing happen

am try to implement this rest api
please help me how can i do that.
Thanks in advance

If I get time over the weekend to knock together an example http post I will

1 Like

Thanks @Judgewest2000

@Judgewest2000 awating for your response please can you give me a sample code of XMLHttpRequest for ionic


I’ve managed to get this knocked up this morning…

It shows you the headers in a POST…


Thanks for giving me your valuable time .please let me try

Really you are a rock. Thanks for save my time its working fine for me