1

I'm new on using ReactJS and I want to know how to redirect after success from ajax call using React without react-route or flux ? Is that possible ? Can someone help me please

Randa
  • 669
  • 2
  • 7
  • 8

2 Answers2

0

You can change window.location.href in your ajax callback to redirect browser to a new url.

Areca
  • 1,292
  • 4
  • 11
  • 21
0

I've not played much with React with React-routes. But You can use JS version.

// similar behavior as an HTTP redirect 
window.location.replace("http://stackoverflow.com"); 

// similar behavior as clicking on a link 
window.location.href = "http://stackoverflow.com";

Source from LINK

Community
  • 1
  • 1
7urkm3n
  • 6,054
  • 4
  • 29
  • 46