SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 181 | Next

Deepak Vohra

"Ajax in Oracle JDeveloper"

7 Sending an Ajax Request with Yahoo Search Web Services 215
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject(???Microsoft.XMLHTTP???);
}
}
var
url=???servlet/yahoo?appid=QwDUK7DV34H98YaFWsa3gHt.P68u
PPI7ThU92omV19uT85g9CAyqBUGmx.8eTF0-???+
???&query=???+encodeURI(document.getElementById(???query???).
value)+
???&results=???+encodeURI(document.getElementById(???result
s???).value)+
???&context=???+encodeURI(document.getElementById(???contex
t???).value);
xmlHttpRequest.open(???GET???, url, true);
xmlHttpRequest.onreadystatechange=processRequest;
xmlHttpRequest.send(null);
function processRequest(){
if(xmlHttpRequest.readyState==4){
if(xmlHttpRequest.status==200){
processResponse();
}
}
}
function processResponse(){
var xmlMessage=xmlHttpRequest.responseXML;
var
searchResults=document.getElementById(???searchResults???
);
var resultHtml="
    ";
    var
    resultList=xmlMessage.getElementsByTagName(???Result???);
    var len =resultList.length;
    for(var i=0; ivar result=resultList[i];
    var
    title=result.getElementsByTagName(???Title???)[0].firstCh
    ild.nodeValue;
    var
    summary=result.getElementsByTagName(???Summary???)[0].fir
    stChild.nodeValue;
    var
    url=result.getElementsByTagName(???Url???)[0].firstChild.
    nodeValue;
    resultHtml+=???
  1. Title:???+??????
    +title+ ???
  2. \n???;
    216 10 Web Search with Ajax
    resultHtml+=???Summary: ???+summary+??????;
    }
    resultHtml+=???
???;
searchResults.


Pages:
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184