|    
			
				09/05/2007, 11:16
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: julio-2006 
						Mensajes: 145
					 Antigüedad: 19 años, 3 meses Puntos: 1 |  | 
  |  google ajax search  
  hola necesito hacer un ejercicio con google ajax search, debe ser igual que utilizando soap me podeis decir como lo puedo cambiar:el .html es:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <title>Google AJAX Search</title>
 <!-- librería API de búsqueda AJAX -->
 <link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>    <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=internal" type="text/javascript"></script>
 
 <script type="text/javascript" src="js/jquery.js"></script>
 <script type="text/javascript" src="codigo.js"></script>
 
 
 <style type="text/css">
 @import url("css/style.css");
 </style>
 <!--[if IE]>
 <style type="text/css">
 @import url("css/style_ie.css");
 </style>
 <![endif]-->
 
 </head>
 
 <body>
 <div id="titulo"><h1>Google Soap Search . Programación con servicios web</h1></div>
 
 <div id="searchcontrol"></div>
 <!--
 <div id="contenido">
 <p>Este ejercicio trata de realizar el mismo ejemplo realizado con el servicio SOAP pero a través del servicio AJAX .</p>
 <p><form id="google_search">
 Panel de búsqueda: <img class="gicon" src="imgs/glogo.gif" align="Google logo" /><input name="search" id="search" type="text" value="buscar..." />
 <input type="submit" id="search_bt" value=""/><span id="progress"></span>
 </form>
 </p>
 -->
 <div id="search_results">
 <p>Los resultados de la consultan deberán aparecer debajo del panel de búsqueda si la consulta SOAP se ha realizado correctamente. </p>
 
 </div>
 </div>
 
 
 
 </body>
 </html>
 
 y tengo otro archivo llamado codigo.js asi:
 
 // Es la función que se ejecutará cuando la API de Google se cargue
 function OnLoad() {
 // Create a search control
 var searchControl = new GSearchControl();
 // Add in a full set of searchers
 var localSearch = new GlocalSearch();
 //searchControl.addSearcher(localSearch);
 searchControl.addSearcher(new GwebSearch());
 
 //Tell the searcher to draw itself and tell it where to attach
 searchControl.draw(document.getElementById("search  control"));
 // Execute an inital search
 searchControl.execute("");    }
 GSearch.setOnLoadCallback(OnLoad);
 
 y el codigo.js del soap es este:
 
 
 function search_mng(){
 var apikey = "TMr9jedQFHLmefxaClyndd27bz2A2W2t";
 var apiurl = "http://api.google.com/search/beta2";
 var wsdlurl = "http://api.google.com/GoogleSearch.wsdl";
 
 function _constructor(){
 this.execute = function(cadena_busqueda, onresults){
 var SOAP_params = new SOAPClientParameters();
 SOAP_params.add("key", apikey);
 SOAP_params.add("q", cadena_busqueda);
 SOAP_params.add("start", 0);
 SOAP_params.add("maxResults", 10);
 SOAP_params.add("filter", false);
 SOAP_params.add("restrict", "");
 SOAP_params.add("safeSearch", true);
 SOAP_params.add("lr", "");
 SOAP_params.add("ie", "");
 SOAP_params.add("oe", "");
 SOAPClient.invoke(apiurl, wsdlurl, "doGoogleSearch",
 SOAP_params, true, onresults);
 }
 }
 return new _constructor();
 }
 var google_search_mng = new search_mng();
 
 
 $(document).ready(function(){
 $("#search").focus(function(){	this.select();
 });
 $("#search").keypress(function(e){	if (e.keyCode == 13){ $("#search_bt").mousedown();}
 });
 $("#search_bt").mousedown(function(){
 $("<img />").attr({"src":"imgs/loading.gif"}).appendTo("#progress");
 google_search_mng.execute($("#search").val(), function(r, soapResponse){
 $("#progress, #search_results").html(""); //quitamos icono de
 $("<p></p>").html("<strong>Tiempo de búsqueda:</strong>"+$("searchTime",soapResponse).text() + "<br />" +
 "<strong>Total de resultados estimados:	</strong>"+$("estimatedTotalResultsCount",soapRespon  se).text() + "<br />"+
 "<strong>Categorías:</strong>"+$("directoryCategories",soapResponse).tex  t()
 ).appendTo("#search_results").fadeIn("slow");
 items = $("resultElements",soapResponse).get(0);
 $("item",items).each(function(){
 $("<p></p>").attr({"class":"search_item"}).html(
 "<h3>"+$("title",this).text()+"</h3>"+
 "<span><strong>URL: </strong><a href='"+ $("URL",this).text()	+"'>"+$("URL",this).text() + "</a>" +
 "<strong>Cacheado: </strong>"+$("cachedSize",this).text() +	"</span><br />" +
 $("snippet",this).text()
 ).appendTo("#search_results").fadeIn("slow");
 });
 $("p.search_item").hover(function(){
 $(this).addClass("item_hover");
 },function(){
 $(this).removeClass("item_hover");
 });
 });
 return false;
 });
 
 $("#google_search").submit(function(){return false; });
 });
 
 tambien ahi otra diferencia que en el del soap tengo un archivo llamado soapclient junto con el queril y en este no de de ajax no.
     |