Results 1 to 5 of 5

Thread: Dynamic Ajax Content with ASP

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

    Default Dynamic Ajax Content with ASP

    1) Script Title:
    Dynamic Ajax Content

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    3) Describe problem:
    hi,
    i've insert this code to display an asp page into another asp page, the external page has some query to select data from database access. So when i try to view this external page into div I don't see anything.
    Is this code incompatible with asp pages?
    Thank for help, and i'm sorry for my terrible english.
    elisa

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

    Default

    It shouldn't matter, as Ajax merely is used here to get the results of the page output by your server. If you can view the asp page correctly on its own within the browser, that same URL can be fed to this script and displayed correctly.

  3. #3
    Join Date
    Oct 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    It shouldn't matter, as Ajax merely is used here to get the results of the page output by your server. If you can view the asp page correctly on its own within the browser, that same URL can be fed to this script and displayed correctly.
    Why i can't view mine external asp page?
    this is my code:

    in my head page:
    <head>
    <script type="text/javascript">

    /***********************************************
    * Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname
    var bustcacheparameter=""

    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)
    }
    if (bustcachevar) //if bust caching of external page
    bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
    page_request.open('GET', url+bustcacheparameter, 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).innerHTML=page_request.responseText
    }

    function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    }
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    }
    }
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    }
    }
    }

    </script>

    </head>

    then in the middle of this page I've this link:

    <a href="javascript:ajaxpage('include-messaggio.asp?idm=<%=objRSm("id_messaggio")%>', 'leggiMex');"><%=Anteprima(objRSm("m_soggetto"))%></a>

    then I've this div:

    <div id="leggiMex"></div>
    <div style="clear: left; margin-bottom: 1em"></div>

    but when i click on the link i don't see anything?

    thanks for your help
    elisa

  4. #4
    Join Date
    Jan 2008
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    did you find your problem? normaly if the asp page errors out it doesnt show in the ajax include container... so make sure you can actualy view your asp page on its own first

  5. #5
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i have a similar problem...my pages are asp with login protection...
    i also tried to load css and js for my div content...really don't understand if i only have to loadobjs css and js and no script on the child page...
    'cause that example doesn't load an href and a style,js together...but it only loadobjs... maybe that's the problem??? i need href and loadobjs together
    P.s.: or the problem is with ASP???

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
  •