Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7875241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:56:58+00:00 2026-06-03T02:56:58+00:00

Im using the below code of ajax // JavaScript Document function createTeam() { var

  • 0

Im using the below code of ajax

// JavaScript Document
function createTeam() {
    var name=document.getElementById("name").value;
    if(name==null || name==""){
        var div3 = document.getElementById("errorMessage");
        var text = "Enter Team";
        div3.style.display = "block";
        div3.style.color = "red";
        div3.style.fontSize = "65%";
        div3.innerHTML = text;
    }else{
        xmlhttp=new XMLHttpRequest();
        xmlhttp.open("POST","/TeamServlet?name="+name+"&task=create",true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.send();
        xmlhttp.onreadystatechange= readResponse;
    }
    function readResponse(){
        if (xmlhttp.readyState == 4)
        {
            response = xmlhttp.responseText;
            $('#button').hide("slow");
            if(response == "false"){
                var div2 = document.getElementById("errorMessage");
                var text = "Unable to create team.";
                div2.style.display = "block";
                div2.style.color = "red";
                div2.style.fontSize = "65%";
                div2.innerHTML = text;
            }
            if(response == "true"){
                var div = document.getElementById("errorMessage");
                var text1 = "Team created.";
                div.style.display = "block";
                div.style.color = "red";
                div.style.fontSize = "65%";
                div.innerHTML = text1;
            }
        }
    }
}

But what happens is when I use this ajax the URL doesnt appear on the address bar of the browser.how can I achieve that? The only url that comes is that after I submit my login form, and that is this http://localhost:8080/LoginServlet?task=login
but after this,even if I navigate to other jsps/servlets none of those url come.How can I fix this ajax code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:57:00+00:00Added an answer on June 3, 2026 at 2:57 am

    This is the basic purpose of AJAX: do Asynchronous request, on the “background”. All request done with AJAX doesn’t trigger the loading icon of the browser nor change the current URL.

    If you want to do something like that, you should have a look to the HTML5 History API. Because it’s a huge subject, I can’t show you “one” answer but I give you some resource to get in:

    • explanation & demo http://html5doctor.com/history-api/
    • explanation & demo http://dev.opera.com/articles/view/introducing-the-html5-history-api/
    • explanation & demo http://diveintohtml5.info/history.html
    • explanation & demo http://robertnyman.com/2011/08/03/html5-history-api-and-improving-end-user-experience/
    • demo http://html5demos.com/history

    The problem you’ll find is that this API is not supported in all browsers, so you’ll need to use a polyfill to make your code cross-browser compatible. Here is a list of cross-browser polyfill you can use:

    • History.js https://github.com/browserstate/history.js
    • PJAX (pushState + ajax = pjax) http://pjax.heroku.com/
    • hashchange jQuery event http://benalman.com/projects/jquery-hashchange-plugin/
    • HistoryManager Mootools Plugin http://mootools.net/forge/p/historymanager/
    • SWFAddress http://www.asual.com/swfaddress/ & jQuery Address http://www.asual.com/jquery/address/
    • jQuery History Plugin https://balupton.com/projects/jquery-history
    • jQuery Ajaxy http://balupton.com/projects/jquery-ajaxy
    • Hasher https://github.com/millermedeiros/hasher/
    • sHistory https://github.com/tatsh/sHistory

    This list is maintained by the Modernizr team, the lasted version is available at https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this jQuery-AJAX code below and a form: <script type=text/javascript> $(document).ready(function () {
I am using the below jquery code to call a ajax function in my
I am using following code to populate DropDown: $(document).ready(function(){ $('#inDistrict').sSelect(); $(#inDistrict).change(function(){ $.getJSON(filldistricts.php,{id: $(this).val(), ajax:
Using the Ajax code, designated below, in the head of my page, ETD2.html ,
I am using below code for sample menu. <html> <head> <title>Tree Demo</title> <script type=text/javascript
Hi everyone I am currently using the below code to run ajax submission on
i am using below code to show google map in asp.net MVC2: <script type=text/javascript
HI i am using the below code for population my autocomplete list. $('#input').autocomplete({ ajax_get
I am using below code to add number of images in a single cell
i am using below code to change the the font type of text view.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.