Results 1 to 2 of 2

Thread: Need help for Ajax script

  1. #1
    Join Date
    Jul 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help for Ajax script

    1) Script Title: AJAX related

    2) Script URL (on DD):

    3) Describe problem: I am new to AJAX but able to understand the working of the AJAX.

    I want to load the pages in background and when clicked on links then it should be shown. And all the pages are from different domains. I am able to get the complete html from the different pages. But when I load that in my pages
    then it gives error like "object not defined", "} expected" etc.

    My code is as follows

    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname

    function ajaxpage(url, containerid){
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e){}
    }
    }
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    page_request.open('GET', url, true)
    page_request.send(null)
    }

    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).value=page_request.responseText

    }


    //have hidden text box
    <input type="hidden" name="TxtSrch" id="TxtSrch" value="">


    //Calling ajax function
    ajaxpage("www.anyserver.com/anypage.hmtl", 'TxtSrch')

    //Writing the content in bottom frame
    parent.bottom.document.write(document.getElementById("TxtSrch").value)

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.

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
  •