Pre[loading|setting] a data feed?

Discussion in 'Javascript' started by lbrtchx@gmail.com, Dec 6, 2008.

  1. Guest

    ~
    I need to preload a data file to feed some js code belonging to a
    page, before the page opens in a crossbrowser way
    ~
    And I need to use the same path, say, "js/data/customdata(.js?)",
    inside the js code
    ~
    I am attempting not to change the js code for each user just because
    the data feed changes
    ~
    I know how to set the content of the data based on users' login info
    and previous configurations, even though the same path to the data
    file is used (that part I do with server side code)
    ~
    Also, do you know of any example of how to dynamically do this
    without users having to login and/or doing a full reload of the page?
    ~
    Thanks
    lbrtchx
    , Dec 6, 2008
    #1
    1. Advertising

  2. SAM Guest

    Le 12/6/08 12:50 PM, a écrit :
    > ~
    > I need to preload a data file to feed some js code belonging to a
    > page, before the page opens in a crossbrowser way
    > ~
    > And I need to use the same path, say, "js/data/customdata(.js?)",
    > inside the js code
    > ~
    > I am attempting not to change the js code for each user just because
    > the data feed changes
    > ~
    > I know how to set the content of the data based on users' login info
    > and previous configurations, even though the same path to the data
    > file is used (that part I do with server side code)
    > ~
    > Also, do you know of any example of how to dynamically do this
    > without users having to login and/or doing a full reload of the page?



    If the page isn't reloaded (that's to say loaded) how can you speak of
    *pre*loading ?

    Without reloading it becomes *post*loading ;-)

    Now, what is the question ?

    Isn't it an Ajax feature what you try to get ?
    <http://www.jibbering.com/faq/#ajaxRef>

    Without Ajax you can try something as following which consists to have a
    function to set what you want with the datas, and another function to
    postload (reload) the JS file of this datas (I can no more reach (call?)
    the file testing the different way to postload JS script as the web-site
    (personal pages on AOL) seems to be closed, so it's possible this
    postload function can abort with some browsers)


    <script type="text/javascript" src="datas.js"></script>
    <script type="text/javascript">
    // all the job to do with the datas
    funtion init() {
    if(data) with (data) {
    // blah
    }
    }
    init();

    function postload() {
    var s = document.createElement('SCRIPT');
    s.type = 'text/javascript';
    s.src = 'datas.js';
    document.getElementsByTagName('HEAD')[0].appendChild(s);
    init();
    return false;
    }
    </script>
    </head>
    <body>
    <p><a href="<?php echo $_SERVER['PHP_SELF'].'?'.rand() ?>"
    onclick="return postload(this)">refresh</a>


    --
    sm
    SAM, Dec 6, 2008
    #2
    1. Advertising

  3. Guest

    On Dec 6, 9:24 am, SAM <>
    wrote:
    > If the page isn't reloaded (that's to say loaded) how can you speak of
    > *pre*loading ?
    >
    > Without reloading it becomes *post*loading ;-)

    ~
    Well, I wasn't clear enough, but based on the context anyone could
    have guessed I meant to actually load some file with data prior to
    running some script which is fed by that data
    ~
    lbrtchx
    , Dec 6, 2008
    #3
    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. Rocky Moore
    Replies:
    7
    Views:
    1,720
    mikeb
    Jan 14, 2004
  2. =?Utf-8?B?S2V2aW4gQnVydG9u?=

    Pre-Send Request Headers, Pre-Send Request Content

    =?Utf-8?B?S2V2aW4gQnVydG9u?=, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,031
    =?Utf-8?B?S2V2aW4gQnVydG9u?=
    Dec 31, 2004
  3. Wladimir Borsov
    Replies:
    7
    Views:
    465
    Raymond Loman
    May 5, 2004
  4. Juha Nieminen
    Replies:
    3
    Views:
    1,133
    Juha Nieminen
    Feb 22, 2008
  5. Chris M. Thomasson
    Replies:
    10
    Views:
    639
    Nobody
    Aug 29, 2009
Loading...

Share This Page