Posted by spaceghost (Guest)
on 26.05.2006 18:08
Greetings,

I'm finally exhausted with trying to figure this out on my own.

I have a div which I'm replacing with the Ajax response -- nothing too 
tough. I know I have the syntax right because it works fine in FF.

However the div html is never replaced in IE.  I know the Ajax request 
is being called on the XML page properly, but no innerHTML replacement 
happens.

// this is the calling page-- works in FF, not IE
http://64.151.124.209:9019/function_list.jsp

// JS is:
<script language="JavaScript" type="text/JavaScript">
<!--
// rico ajax
function registerAjax() {
	ajaxEngine.registerRequest( 'get_function_info', 
'http://64.151.124.209:9019/get_function_info.jsp' );
	ajaxEngine.registerAjaxElement( 'functionInfo');
}
// Sending the request
function getFunctionInfo(selectBox) {
   var funcid = selectBox.value;
   var cxs = document.getElementById("functionInfo");
   cxs.innerHTML = "Loading...";
   ajaxEngine.sendRequest( 'get_function_info','funcid=' + funcid);
}
-->
</script>



// this is the XML page
http://64.151.124.209:9019/get_function_info.jsp?funcid=310

// output is:
<?xml version="1.0" encoding="utf-8"?>
<ajax-response>
 <response type="element" id="functionInfo">
  <div class="function"><span class="title">=FTEST(</span>   <span 
class="microFNT">
	<input name="param_0" type="text" size="2" class="microFNT"/>			</span>
	<span class="title">)</span>
	</div>
 </response>
</ajax-response>

Any help would be greatly appreciated!
Posted by Brian (Guest)
on 26.05.2006 18:32
Do you mean to say that the "Loading..." string is not appearing or that 
the output HTML is not appearing?

If it's the latter, I don't see any code that's trying to set the output 
HTML to anything.
Posted by spaceghost (Guest)
on 26.05.2006 18:36
Hi Brian,

Thanks for the quick response.

Actually if you click the link, you'll see the 'Loading...' string works 
fine.

In FF, this is quickly replaced with the Ajax response as registered 
with:

	ajaxEngine.registerAjaxElement( 'functionInfo');

However in IE, this does not happen.  'Loading...' is the only thing 
shown.

I have used a script debugger and seen that the response actually gets 
back to IE from the XML page, so it appears to be something in the Rico 
Ajax not changing the innerHTML of the div after the request comes back 
okay.

Note I've tried this all with a stripped down version of the XML, not 
using the 'loading...' etc.  Nothing seems to make the innerHTML want to 
change to the XML response.

-john
Posted by Sebastian Miranda
on 01.06.2006 09:27
Hi John,

Did you find any solution for this??? because I have the same problem 
with IE, sometimes works and sometimes don't. I found that the response 
object is null, but I know that the response was sent, it appears that 
rico don't caught the response.

thanx

Sebastián
Posted by Ross Lawley
on 01.06.2006 10:45
Can you post an example that replicates this?

Im not interested in the server side language - just the html to create 
the page and Ajax call and the txt of Ajax response.

Do that and you will probably find the cause, if not post it here and 
I'll find the cause! ;)

btw spaceghost- Using firebug in firefox I can see there are javascript 
errors on the page.  Firefox may be playing nicer and allowing js to 
continue, where as IE might be stopping processing as soon as it hits 
the error..

Ross
Posted by Sebastian Miranda
on 01.06.2006 11:13
Hi Ross,

This is the page code, is just to get client's name from account number.
Using fireBug I don't get any error.

// This is the form page

<head>
<script src="/webgallo/ajax/prototype.js"
type="text/javascript"></script>
<script src="/webgallo/ajax/rico.js" type="text/javascript"></script>
<script src="ajax.js" type="text/javascript"></script>
</head>
<body onload="actualizar_TipoPedido();registerAjaxStuff();">


<form name="datosCabecera" action="tratarPedido.dsp" method="POST"
onSubmit="JavaScript:return comprobarDatosCabPedido();">
 <br> <br>
 <span class="pestanya">Cabecera Pedido <small></small></span>
 <div id="cabecera" >

<div class="linearesaltada">

       <span class="campo" ><b>Sector:</b>

             <select id="sector" name="SECTOR"
onchange="JavaScript:actualizar_TipoPedido();getClientData('CUSTOMERNO');">
              <option class="PS" value="PS">PS</option>
              <option class="PF" value="PF" >PF</option>
              <option class="MB" value="MB" >MB</option>
             </select>

               </span>
       <span ><b>Tipo Pedido:</b>
             <select id="tipoPedido" name="TIPO_DOCUMENTO">
                  <option value="-">-</option>
             </select>
       </span>
     </div>
 <div class="linea">
  <span class="campo" >Destinatario de mercancía:</span>

    <input type="text" name="CUSTOMERNO" id="CUSTOMERNO" value=""
size="15" maxlength="10"  onBlur="getClientData('CUSTOMERNO');"> &nbsp;
        <img class="imagen"
src="/GALLO_BaseEDI/icons/botonesSAP/buscar.gif"
onClick="JavaScript:openWindow( document.datosCabecera.CUSTOMERNO ,
'./buscarClienteSAP.dsp' ); " >
        <input type="checkbox" id="inauguracion" name="inauguracion"
value="X" onClick="JavaScript:checkInauguracion();" /> Cuenta Nueva
  <br>


  <span id="clientError"  class="cliente" ></span>
  <span id="clientName"  class="cliente" width="100%"></span>

   <input type="hidden" name="action" value="crearCabecera" />
   <button name="" type="submit" width="10"><img
src="/GALLO_BaseEDI/icons/botonesSAP/aceptar.png"> Añadir Líneas
</button>

 </div>

 </div>
</form>
</body >


/************************
This is the ajax.js fike
*************************/

function registerAjaxStuff() {
    ajaxEngine.registerRequest('getClientData',
'/invoke/gallo.sap.consultas.ajax:infoClienteSAP');
    ajaxEngine.registerAjaxElement('clientName');
    ajaxEngine.registerAjaxElement('clientError');
}

function getClientData(id){
    if(document.getElementById('inauguracion').checked){
              document.getElementById('clientName').innerHTML='<span
class=cliente >Cliente Especial - Nueva Cuenta</span>'
    }
    else{
         var cxs = document.getElementById("clientName");
         cxs.innerHTML = "Consultando SAP..." + Date();
         var client = $(id).value;
         var Var1Selected =
document.getElementById('sector').selectedIndex;
         var sectorSeleccionado =
document.getElementById('sector').options[ Var1Selected ].value;
         //alert("sector: "+ sectorSeleccionado + "  Cliente: "+
client);
         if(client.length > 5){
             ajaxEngine.sendRequest('getClientData', "CUSTOMERNO=" +
client, "PI_DIVISION=" + sectorSeleccionado);
         }

    }
}


/************************
This is the AJAX response
*************************/

<ajax-response>
  <response type="element" id="clientError">
    <span>If error, place it here</span>
  </response>
  <response type="element" id="clientName">
    <span class="cliente">
      <b>Client's Name</b>
      <small>City</small>
    </span>
  </response>
</ajax-response>


Thanx for the quick response !!

Sebastián
Posted by sjoukew (Guest)
on 02.06.2006 20:11
I have a similar problem as this one.
I have a div which should be filled with some data from the ajax 
request, but the inner html is never updated.
It works in opera 75% of the time, at 5% of the times in FireFox and 
never in IE.
Whatever I do, I never get an exception or error from any javascript.
I have tried to debug, I know for certain that the content is sent to 
the browser, but somewhere where rico is parsing the response into XML 
it 'suddenly' get's lost.
The rico code and usage is very similar to this example.
My quess is that the parsing of the recieved content goes wrong 
somehere, as the response.
in rico.js around line 475 the code is "var response = 
request.responseXML", this is where the responseXML gets empty.
In opera it is showing the XML as it should, in IE and Firefox it is 
empty, and i can't find why.

Maybe this information helps and you can see if this is the case in your 
situation.
Posted by Ross Lawley
on 03.06.2006 07:06
 sjoukew - that means you have invalid XML - please ensure its always 
valid and you have set the content type headers correctly.
Posted by Guest (Guest)
on 03.06.2006 11:47
it is valid xml, I double checked that.
** start xml response **

<?xml version="1.0" encoding="iso-8859-1"?>
<ajax-response>
<response type="element" id="cat199" >

<table><tr><td>test</td></tr></table>

</response>
</ajax-response>
** end response **
Posted by Sebastian Miranda
on 06.06.2006 16:28
btw,

In my case, it works fine always in Firefox but only sometimes in IE.

Sebastián
Posted by Code Monkey (Guest)
on 13.06.2006 01:58
I'm having a simular problem...  My code ALWAYS works in Firefox, Opera
and Safari, but never in IE.  I've checked my xml responce and it's
correct.  If anyone is willing to take a look for me please send me an
email at mike @ myflipside dot net.  I would post a link here but I only
have this on a development server and don't want the url made public.

-Mike LP
Posted by Code Monkey (Guest)
on 13.06.2006 04:16
I solved my problem.  It was using utf8 for an encode type in my 
responce XML.  I really hate IE
Posted by Sebastian Miranda
on 13.06.2006 14:05
I think I found why only works sometimes in IE, I think is because IE 
only loads the response the first time, later it takes the response from 
the cache and you don't get your data updated.

I'll do more test and say something...

Sebastián
Posted by Guest (Guest)
on 20.06.2006 16:27
I don't know how much this will help, but I noticed that IE will not
display a response that includes <table></table> tags in it.  FF
displays it fine, but IE chokes.  I had a response that was

**html pertaining to the ajax
<div id='containerId'>
</div>
**html end

**xml start
Content-type: text/xml

<?xml version="1.0" encoding="UTF-8"?>

<ajax-response>
<response type="element" id='containerId'>
<table><tr><td>some text</td></tr></table>
</response>
</ajax-response>
**xml end

I placed alerts in the javascript to figure out where the response lost
its value, and it never lost it.  The innerHTML call just didn't work in
IE.  In order to get mine to work, I had to rewrite my response using
either just text and no formatting or I had to use divs to format it.
Once I switched over to divs it displays fine in IE and FF.

Joel
Posted by kuste (Guest)
on 22.06.2006 11:29
Hey,

i have(had) the same problem. After searching for a long while, I found 
this.

In file prototype.js (near line 739)

<code>
Ajax.Updater = Class.create();

Object.extend(Object.extend(Ajax.Updater.prototype, 
Ajax.Request.prototype), {
  initialize: function(container, url, options) {
    alert(container);
    this.containers = {
      success: container.success ? $(container.success) : $(container),
      failure: container.failure ? $(container.failure) :
        (container.success ? null : $(container))
    }
</code>

Container should be the ID of the HTML - Element.
The content of container instead is my query-string. Changing 
$(container) to the id of the element solved my problem.
Since I have to go for a walk with my dog, i will publish the final 
solution for this later (if not someoneelse is doing this).

Greetings
Stefan
Posted by kuste (Guest)
on 22.06.2006 14:04
So here what solved my problem,

maybe it is helpful for someone.

I replaces the function call ajaxEngine.sendRequest with 
ajaxEngine.sendRequestAndUpdate, what sounds logical to me.

sendRequest -> send data without handle the response
sendRequestAndUpdate -> send data and show the response.

But I wonder, why it seems to work in the demo.
Anyhow. If your soultion not works, try sendRequestAndUpdate.

XML valid response or not seems to be indifferent.
Posted by Issachar Brooks
on 30.11.2006 23:06
To me it seems like IE doesn't pass on the options for the request, 
although I have no way to verify this. Here's my code:

 window.onload = function() {
      new Effect.Fade('loading', {duration:1.0});
      new Effect.Appear('mainWrapper',{delay:1.0, duration:0.8, 
fps:40});
      ajaxEngine.registerRequest( 'refreshmain', 'processor.php');
      ajaxEngine.registerAjaxElement('navMainWrapper');
      ajaxEngine.registerAjaxElement('navBreadCrumb');
      ajaxEngine.registerAjaxElement('navColumnOneContent');
      ajaxEngine.registerAjaxElement('centerColumn');
      ajaxEngine.sendRequest('refreshmain', 'req=inc_menu');
      ajaxEngine.sendRequest('refreshmain');
  }

The second request works fine in IE, but the first one (with 
'req=inc_menu') does nothing. When I use sendRequestAndUpdate, it does 
not pass on the options either. Where is the problem?

Issachar
Posted by Thibaut de Sany
on 28.03.2007 09:24
Do not forget to use method:'post' as argument
such as

EXAMPLE
ajaxEngine.sendRequestAndUpdate('getPersonInfo','personInfo2',{method:'post',evalScripts:true,parameters:pars});

If you do not, sometimes your request will be submitted, sometimes not!

With best regards,
Thibaut de Sany.
Posted by tostis tostis
on 10.04.2007 11:39
i have the same problem: rico works well with firefox and opera but not
with ie. the xml response arrives correctly to ie but rico doesn't
substitute innerhtml of element.
how i should write <?xml version="1.0" encoding="UTF-8"?> in php file? i
that the solution?


EDIT: i solved the problem with
        header("Content-Type: text/xml");
        header("Cache-Control: no-cache, must-revalidate");
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
Posted by Markus Nichterl
on 06.12.2007 11:18
Hallo everybody!

Rico with IE seems to be very tricky. I have the following Code:

function getRandom()
{
	//Zufallszahl zwischen 1 und 10
	return (Math.floor(Math.random()*10))+1;
}

function getKeks()
{
  ajaxEngine.sendRequestAndUpdate('getFortuneCookie',
mimeType="text/x-rico",{method:'get'});
}

var CookieHandler = Class.create();
CookieHandler.prototype =
{
	initialize: function()
				{},
	ajaxUpdate: function(ajaxResp)
				{
					var random = getRandom();
					var cookieMessage =
ajaxResp.getElementsByTagName('cookie')[random-1].firstChild.data;
					document.getElementById("fortuneMessage").innerHTML =
cookieMessage;
				}
};

function presetAjax()
{
	ajaxEngine.registerRequest('getFortuneCookie',
'cookies_rico_object.xml');
	ajaxEngine.registerAjaxObject('fortuneMessage', new CookieHandler());
}
...
<div id="fortuneMessage"></div>
<form action="">
<input type="button" value="Neuer Gl&uuml;ckskeks (Rico)"
onclick="getKeks();" />
</form>
</div>
...

In Firefox everything seems to be okay, but in IE nothing happens. I
have tried some of the above hints, but nothing worked. Can anyone help
me, please?

btw.: Response type='object'

PS: i am not able to login into the forum with IE7 -> very strange, i 
have to use firefox
Posted by Markus Nichterl
on 07.12.2007 12:33
now, everything works fine. perhaps some caching-problems with ie7, but 
who cares.