Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/10/2009, 09:54
Avatar de mc_quake
mc_quake
 
Fecha de Ingreso: enero-2006
Ubicación: www.ecocargo.cl
Mensajes: 683
Antigüedad: 18 años, 4 meses
Puntos: 8
Retornar dos valores en div distintos

hola he buscado por google y paginas varias y no he podido encontrar la forma de
hacer una funcion en ajax que me devuelva dos resultados y en div distintos

este es mi codigo y las funciones son recibeid y recibeid2
y cada una me la da en un distinto

llamandolas asi

Código HTML:
Ver original
  1. <input name="pr_precioprovee" type="text" class="fiels" id="pr_precioprovee" style="width:40px; text-align:right;" onmouseover="recibeid('../ajax/valida_pro.asp','','pr_precio='+forme.pr_precioprovee.value+'','micapa2')"  value="<%= Money(Rs("pr_precioprovee"))%>" />

Código HTML:
Ver original
  1. <img src="../_imag/_sitio/carrorefre.jpg" width="16" height="19" border="0" title="Haga Click aqu&iacute; para Actualizar" onclick="recibeid2('../ajax/valida_pro2.asp','','pr_precio='+forme.pr_precioprovee.value+'','micapa3'); " />


Código ajax:
Ver original
  1. <script>
  2. function objetus(file) {
  3.     xmlhttp=false;
  4.     this.AjaxFailedAlert = "Su navegador no soporta las funciónalidades de este sitio";
  5.     this.requestFile = file;
  6.     this.encodeURIString = true;
  7.     this.execute = false;
  8.     if (window.XMLHttpRequest) {
  9.         this.xmlhttp = new XMLHttpRequest();
  10.         if (this.xmlhttp.overrideMimeType) {
  11.             this.xmlhttp.overrideMimeType('text/xml');
  12.         }
  13.     }
  14.     else if (window.ActiveXObject) { // IE
  15.         try {
  16.             this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  17.         }catch (e) {
  18.             try {
  19.                 this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  20.             } catch (e) {
  21.                 this.xmlhttp = null;
  22.             }
  23.         }
  24.         if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
  25.             this.xmlhttp = new XMLHttpRequest();
  26.             if (!this.xmlhttp){
  27.                 this.failed = true;
  28.             }
  29.         }
  30.     }
  31.     return this.xmlhttp ;
  32. }
  33. function recibeid(_pagina,valorget,valorpost,capa){
  34.     ajax=objetus(_pagina);
  35.     if(valorpost!=""){
  36.         ajax.open("POST", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  37.     } else {
  38.         ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  39.     }
  40.     ajax.onreadystatechange=function() {
  41.         if (ajax.readyState==1){
  42.             document.getElementById(capa).innerHTML =
  43.                 "";
  44.         }
  45.         if (ajax.readyState==4) {
  46.             if(ajax.status==200)
  47.             {document.getElementById(capa).innerHTML = ajax.responseText;}
  48.             else if(ajax.status==404)
  49.             {
  50.                 capa.innerHTML = "La direccion no existe";
  51.             }
  52.             else
  53.             {
  54.                 capa.innerHTML = "Error: ".ajax.status;
  55.             }
  56.         }
  57.     }
  58.     if(valorpost!=""){
  59.         ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  60.         ajax.send(valorpost);
  61.     } else {
  62.         ajax.send(null);
  63.     }
  64. }
  65.  
  66. function recibeid2(_pagina,valorget,valorpost,capa){
  67.     ajax=objetus(_pagina);
  68.     if(valorpost!=""){
  69.         ajax.open("POST", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  70.     } else {
  71.         ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  72.     }
  73.     ajax.onreadystatechange=function() {
  74.         if (ajax.readyState==1){
  75.             document.getElementById(capa).innerHTML =
  76.                 "";
  77.         }
  78.         if (ajax.readyState==4) {
  79.             if(ajax.status==200)
  80.             {document.getElementById(capa).innerHTML = ajax.responseText;}
  81.             else if(ajax.status==404)
  82.             {
  83.                 capa.innerHTML = "La direccion no existe";
  84.             }
  85.             else
  86.             {
  87.                 capa.innerHTML = "Error: ".ajax.status;
  88.             }
  89.         }
  90.     }
  91.     if(valorpost!=""){
  92.         ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  93.         ajax.send(valorpost);
  94.     } else {
  95.         ajax.send(null);
  96.     }
  97. }
  98. </script>

divs donde se muestran los valores
Código HTML:
Ver original
  1. <div id="micapa3"></div>
  2. <div id="micapa2"></div>

lo que necesito es en ves de dos funciones solo una que me devueva dos valores en dos div distintos
__________________
Mc_Quake

Para ayudar en lo que se pueda:Zzz: