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 178 | Next

Deepak Vohra

"Ajax in Oracle JDeveloper"


Modify the input.jsp to add JavaScript functions to send an Ajax request
to the Contextual Web Search Web Service and update the web page with
the Web Service response. To the input element of type button add a
onclick event handler to invoke a JavaScript function
displaySearchResults().
onclick=???displaySearchResults()???/>
In the displaySearchResults function create an
XMLHttpRequest object. XMLHttpRequest is supported as a native
object in some browsers such as Netscape 6+ and IE7 and as an
ActiveXObject in other browsers such as IE 6.
var xmlHttpRequest=init();
function init(){
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject(???Microsoft.XMLHTTP???);
}
}
Specify the proxy servlet URL to which an Ajax request is to be sent.
Obtain the values for query, results and context request parameters from
the input form. Encode the request parameter values using the
encodeURI method.
var
url=???servlet/yahoo?appid=QwDUK7DV34H98YaFWsa3gHt.P68u
PPI7ThU92omV19uT85g9CAyqBUGmx.8eTF0-???+
???&query=???+encodeURI(document.getElementById(???query???
).value)+
???&results=???+encodeURI(document.getElementById(???resu
lts???).value)+
???&context=???+encodeURI(document.getElementById(???cont
ext???).value);
Open an XMLHttpRquest request using the open() method. If few
context terms are to be used the GET method may be used.


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