SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    eez
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XMLHttpRequest questions

    Hi!

    For a GET request, do I have to specify the null value in the send fucntion or can I just do this:

    request.send();


    Second question: in the open() method, can I do this: leaving ou the third argument of true for async requests... the true is the default after all!)

    request.open("get", "http...");


    In a larger perspective, can I leave out values that are default values in functions?


    Thanks!

  2. #2
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To answer your questions:

    1. Yes, you may leave out the 'null'
    2. Async is 'true' by default, so it is not necessary to include that argument
    3. This question is slightly ambiguous. For "built-in" functions/methods, the default values are typically unnecessary. For user-defined functions, you need to programmatically deal with the absence of an argument and define the default value.


Bookmarks

Posting Permissions

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