Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member10945
Contributor
0 Kudos
Just in time for voting for TechED presentors and to follow-up my previous more theoretical blog post, I give you (maybe?) the first AJAX SAP Web Application (If AJAX sounds more like something you use to clean your dishes have a look at SAP Web Applications the Google Way).  This is the simplest possible AJAX application but introduces all the major concepts except using XSLT sheets to translate XML to HTML.  This is however, covered in depth and better then I could talk about it in multiple places on the internet.   I will be covering this and more topics in my TechEd presentation, you can vote for it here  (Mine is entitled, "Framework for Client-Rendered Web Applications in SAP ").  FYI:  This example will only work in IE, however, it is trivial to get it running in Mozilla, et. al.


How-To Steps


    span.hidden

function getName(){
var url = "data.xml";
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req){
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
}
else{
alert("Failed to Create XML Request Object.");
}

}

function processReqChange(){
if (req.readyState == 4){
if (req.status == 200){
var firstName;
var lastName;
var response;
response = req.responseXML;
FirstName.innerText = response.getElementsByTagName("FirstName")[0].firstChild.data;
LastName.innerText = response.getElementsByTagName("LastName")[0].firstChild.data;
output.className = "";
}
}
}





Run


id="output" class="hidden">h3. Name


    • Last Name: id="LastName">








    1. Test the page entitled ajaxTest.html


Conclusion


As you can see from this very simple demo, you have full control over the XML returned from data.xml.  This would allow you to create much more complex applications that communicate using XML.  Examples of these types of applications will be made available and explained at TechEd, assuming of course you go vote for me  :smile:


4 Comments