- Feb 8, 2004
- 12,604
- 15
- 81
Should I use this Java code from the server to redirect the user to a new page
Or should I just send the URL as a string with PrintWriter so JavaScript can use
Im going back over some of my early code and AJAXifying it which required me to send the URL to JavaScript rather than use Java sendRedirect() method. I like consistency so if I can have the whole website work the same way for requests that would be great. Theres no downfalls to just sending the URL string right?
Code:
response.sendRedirect(URLString);
Code:
window.location = URLString;
Im going back over some of my early code and AJAXifying it which required me to send the URL to JavaScript rather than use Java sendRedirect() method. I like consistency so if I can have the whole website work the same way for requests that would be great. Theres no downfalls to just sending the URL string right?