-3

I have a react function called bound on the constructor that gets called on the click of an "update" button. Within that update method, I want to do a simple HTTPS get request something like this

xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET","https://test", true)
xmlHttp.send(null)
enter code here

But I want to open a new tab when it does this I have not imported Axios or anything else.

Kartikey
  • 4,516
  • 4
  • 15
  • 40
pronane
  • 248
  • 1
  • 5
  • 10

2 Answers2

0

Don't forgot write callback of your xmlHttp

xmlHttp.onreadystatechange = yourcallback
Sergey Volkov
  • 871
  • 11
  • 17
0
xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET","https://test", true)
xmlHttp.send(null)

This works without needing to make changes but its better with the callback if you want to do any handling of the statuses that may be sent back.

pronane
  • 248
  • 1
  • 5
  • 10