Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MMM 4 posts 24 karma points
    Nov 24, 2010 @ 15:53
    MMM
    0

    How can I pull a document type from an aspx page using AJAX?

    Here is the code I am using to pull data using AJAX (I am new to all of this by the way) And got this using the w3schools

     <script type="text/javascript">
     function loadXMLDoc()
    {
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
      
         {
        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
        }
      }
      xmlhttp.open("GET","1104.aspx",true);
    xmlhttp.send();
    }

    </script>

    <div id="myDiv"></div>
    <button type="button" onclick="loadXMLDoc()">Request data</button>

    This pulls up the ENTIRE page.  But what I am looking to do is pull up a specific content (document type) from certain pages. 

    I created pages in the CONTENT area of Umbraco, and on them, I have several rich text editors (from document types) containing several paragraphs each. 

    On a separate page, I would like to call these particular content areas INDIVIDUALLY.  For example, I would have a list of names, and on each onclick, a new "quote" would appear in the content area in a DIV without refreshing the page. 

    - another thing - I managed to pull just the info I wanted using XSLT this way:
       
     <xsl:value-of select="umbraco.library:Item('1104', 'quote10')" disable-output-escaping="yes"/>

    And it populates just that item, not the entire page (onload), but the only way I can get it to click with XSLT and change to a new quote refreshes the ENTIRE page.

    How can this be done with Umbraco, specifically calling a Document type on another page, preferably using AJAX so the page doesn't refresh on each click? 

    Any help would be greatly appreciated!


Please Sign in or register to post replies

Write your reply to:

Draft