Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: ajax username

  1. #1
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts

    ajax username

    Hello, i have a script, and to sign up for it, you put a username, and all the other info, but i want a little ajax modification on it so next to the username box it will show what their profile url will look like

    Username : [ USERNAME INPUT BOX ] http://www.mysite.com/{what they typed}

    anyone know of any premade scripts that can do this

  • #2
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    This will do it you don't need ajax
    Code:
    <script type="text/javascript">
    var url = "http://www.mysite.com/";
    function updateURL(folder){
         document.getElementById('preview').innerHTML = url+folder.value;
    }
    </script>
    <input type="text" onchange="updateURL(this)">
    <div id="preview"></div>

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    You could also do it on keyup:

    Code:
    <script type="text/javascript">
    var url = "http://www.mysite.com/";
    function updateURL(folder){
         document.getElementById('preview').innerHTML = url+folder.value;
    }
    </script>
    <input type="text" onkeyup="updateURL(this)">
    <div id="preview">http://www.mysite.com/</div>

  • #4
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    now that I think about it he probably needs AJAX to check for repeat user names.

    @zangeel what is your server side language?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •