www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help with funciton

  1. #1
    Join Date
    Aug 2009
    Posts
    1

    Question Help with funciton

    Hi,
    I have these functions :

    Code:
    function loadAjax(ajaxTrigger,triggerAction,ajaxLoadingContentSource,ajaxLoadingContainerId) {
        var trigger = document.getElementById(ajaxTrigger);
        trigger.addEventListener(triggerAction, sendAjaxRequest(null,ajaxLoadingContentSource,ajaxLoadingContainerId), false);
    }
    
    function sendAjaxRequest(ev,ajaxLoadingContentSource,ajaxLoadingContainerId) {
        var request = new XMLHttpRequest();
        request.open("GET", ajaxLoadingContentSource, true);
        request.onreadystatechange = ready(null,ajaxLoadingContainerId);
        request.send(null);
    }
    
    function ready(ev,ajaxLoadingContainerId) {
        var r = ev.target;
        if (r.readyState != 4) return;
        var div = document.getElementById(ajaxLoadingContainerId);
        div.innerHTML = r.responseText;
    }
    It is supposed to load data content from a distant page..

    But it is not working , can you please look at it and tell me where the problem is ?

    thank you very much for your answers ,

    Ondra

  2. #2
    Join Date
    May 2005
    Location
    Dirty Jersey
    Posts
    1,400
    It is supposed to load data content from a distant page..
    so you mean that this script is running on www.yahoo.com (for example) trying to get data from/to www.google.com? the default behavior of ajax is to prevent this, if so. i have no idea how to make it work, but i've heard it's possible with tweaking.

    1. If you reply to my post, and your reply would then appear directly beneath my post, DON'T QUOTE MY ENTIRE POST!!! IT'S REDUNTANT!!! IT'S ASININE!!!! IT'S REDUNDANTLY ASININE!!!!! DON'T DO IT!!!!
    2. jQuery extends the functionality of JavaScript. If you don't know JavaScript, give up on that jQuery script and learn JavaScript. You'll save yourself a lot of frustration, I promise.
    3. Use the [code][/code] tags. Otherwise, you may be left wondering why no one responded to your eyesore of a thread.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles