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,402
    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.

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