Capture Ajax response

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
kno
Posts: 2
Joined: Thu Mar 22, 2007 9:55 am

Capture Ajax response

Post by kno » Thu Mar 22, 2007 10:03 am

Is it posible to capture an AJAX response with IMacros and manage it with javascript?
Thanks
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Thu Mar 22, 2007 10:32 am

Hi,

iMacros works with many AJAX elements, but not all are supported yet.

If you post the URL of the website, we can look into it.
kno
Posts: 2
Joined: Thu Mar 22, 2007 9:55 am

Post by kno » Thu Mar 22, 2007 10:40 am

Its an intranet and I cant make it accesible via Internet. I'm doing an xmlhttprequest and It returns an xml that is treated in a javascript function:

Code: Select all

function showResponse(respuestaXML)
{
	respuesta = respuestaXML.responseText;
	xml = respuestaXML.responseXML.documentElement;
	if (xml.getElementsByTagName('estado')[0].firstChild.data == 1)
	{
		$("Resultado").style.backgroundColor = "green";
	} else {
		$("Resultado").style.backgroundColor = "red";
	}
	var respuesta = xml.getElementsByTagName('mensaje')[0].firstChild.data;
	Element.show("Resultado");
	Element.update("Resultado",respuesta);
	setTimeout("Oculta_Resultado()", 3000);
	eval(xml.getElementsByTagName('script')[0].firstChild.data);
}

I would want to know if if xml.getElementsByTagName('estado')[0].firstChild.data is set to 1 (the query was succesful).
Can I do it with iMacros?
Thanks again.
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Thu Mar 22, 2007 2:30 pm

I would want to know if if xml.getElementsByTagName('estado')[0].firstChild.data is set to 1 (the query was succesful).
If it is 1, is there any indication on the website (the rendered page)? E. g. a string that says "success"? If yes, iMacros can check for this.

Please see the post about AJAX Testing for details on how to do this.
Post Reply