Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Tiya Khambadkone
Ranch Hand
Posts: 110
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65104
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic