AJAX question..

Discussion in 'Javascript' started by Frances, May 31, 2006.

  1. Frances

    Frances Guest

    am just starting out with AJAX, got example from here,
    http://www.w3schools.com/ajax/ajax_example.asp working fine

    but I have a question (actually I have many questions, but will start
    with this one for now..)

    in this line of code

    var url="gethint.asp?sid="+Math.random()+"&q="+str

    what is purpose of 'sid' param in query string, this is not used at all
    in code, I even changed this line to..

    var url="gethint.asp?q=" + str

    and it worked just as well.. thank you...
    Frances, May 31, 2006
    #1
    1. Advertising

  2. Frances wrote:


    > in this line of code
    >
    > var url="gethint.asp?sid="+Math.random()+"&q="+str
    >
    > what is purpose of 'sid' param in query string, this is not used at all
    > in code,


    It might be an attempt to prevent the browser from returning a cached
    resource.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, May 31, 2006
    #2
    1. Advertising

  3. Frances

    Guest

    Frances wrote:
    > am just starting out with AJAX


    I really like the w3schools tutorials. Once you finish those I suggest
    you look at the Yahoo! UI connection library for something you might
    use in your real projects.

    http://developer.yahoo.com/yui/connection/

    Peter
    , May 31, 2006
    #3
  4. Frances

    the DtTvB Guest

    Andy Baxter wrote:
    > sid usually means 'session identification' i.e. it's the server's way of
    > remembering that you are the same user across a series of otherwise
    > unrelated page requests. Http is a stateless protocol which doesn't
    > remember who you are between one request and the next, so people have to
    > invent tricks like this to get round that.


    Yes, it is, but not in this one..
    That number is "not" session id, but it's a random number just to
    prevent cache.
    Like if I do the first request on 7:50:21 and I do the same URL request
    again on 7:50:30, the browser may get the cached (saved) or outdated
    data on 7:50:21. I have to put some random number on my URL request.
    Sometimes I even used Math.random() + '' + new Date().getTime()

    My question is why did they used the word 'sid' while it's not sid?
    the DtTvB, Jun 1, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    20
    Views:
    1,873
    d1srupt3r
    Mar 31, 2008
  2. darrel

    beginner AJAX questions (AJAX.net)

    darrel, Apr 27, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    2,421
    Flinky Wisty Pomm
    Apr 28, 2006
  3. jobs
    Replies:
    0
    Views:
    352
  4. =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?=

    Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta

    =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?=, Feb 20, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    580
    Patrick
    Feb 21, 2007
  5. minnie
    Replies:
    1
    Views:
    670
    Andrew Thompson
    Dec 13, 2006
Loading...

Share This Page