my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Ajax - I want to open a URL in the same window . how can i do that ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajax - I want to open a URL in the same window . how can i do that ?" Watch "Ajax - I want to open a URL in the same window . how can i do that ?" New topic
Author

Ajax - I want to open a URL in the same window . how can i do that ?

Tiya Khambadkone
Ranch Hand

Joined: Sep 15, 2011
Posts: 52
I want to navigate to the url as I click on the 'Go' link on my existing page.
I am using jsp and ajax.
The code I have written is :

function launchURL(){
ajaxRequest.open("GET", "someContextRoot/hardcodedPath.do?customerName=" + custName + "&customerID=" + custID, false);
ajaxRequest.send(null);
}

<a href="#" onclick="launchURL();">Go</a>

The URL getting built is correct but I am not able to load the URL page on the same window.
How can I do that ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60745
    
  65

Don't use Ajax for that. The whole point of Ajax is to not replace the current page. If you want a "normal" submission that replaces the current page, use a "normal" hyperlink or form submission.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ajax - I want to open a URL in the same window . how can i do that ?
 
Similar Threads
Regarding response.sendredirect
pass <bean:write> to a function
registration page using jsp and ajax
passing the values from popup window to jsp
Trigger action on combo change