[Catalyst] Ajax Problem.

Mesdaq, Ali amesdaq at websense.com
Wed Jan 5 17:44:57 GMT 2011


I recommend testing this using Firefox with Firebug enabled so you can watc=
h the AJAX request and you can also print to the console to see what your r=
esponse looks like to make sure it=92s what you=92re expecting

console.log(xmlhttp.responseText);
document.getElementById("data").innerHTML=3Dxmlhttp.responseText;

Thanks,
------------------------------------------
Ali Mesdaq (CISSP, GIAC-GREM)
Sr. Security Researcher
Websense Security Labs
http://www.WebsenseSecurityLabs.com<http://www.websensesecuritylabs.com/>
------------------------------------------

From: Rohan M [mailto:rohan7799 at gmail.com]
Sent: Wednesday, January 05, 2011 3:07 AM
To: catalyst at lists.scsys.co.uk
Subject: [Catalyst] Ajax Problem.

Dear All,

I want to use Ajax in my Catalyst application.

Thing's that I've done till now :

1) Created a Javascript function on an event (onblur event) in my view (tt =
page).
2) Created xmlhttp object in that Javascript function.
3) Called the '/controller/action' path with parameters.
4) The Action subroutine searches database and puts results in the stash

I could see, the things are working till the fourth step correctly.

Now, how can I render the stash variables in the current tt page?

Or Will I need to parse the entire content?

Is there a better solution for this problem?

Any help or similar (simple) example will be appreciable.

CODE SNIPPET
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

function getDetails(id)
            {
                        var param =3D "id=3D"+id;
                        if (window.XMLHttpRequest)
                        {
                                    xmlhttp=3Dnew XMLHttpRequest();
                        }
                        else
                        {
                                    xmlhttp=3Dnew ActiveXObject("Microsoft.=
XMLHTTP");
                        }

                        xmlhttp.open("GET","/indexer/getid/"+"?"+param,true=
);
                // /controller/action url
                        xmlhttp.send();
                        xmlhttp.onreadystatechange=3Dfunction()
                        {
                                    if (xmlhttp.readyState=3D=3D4 && xmlhtt=
p.status=3D=3D200)
                                    {
                                                document.getElementById("da=
ta").innerHTML=3Dxmlhttp.responseText;
                                // the element to render output
                                    }
                        }
                        show();

            }

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


Thanks and regards,
Rohan



Click here<https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg=3D=3D> to =
report this email as spam.


 Protected by Websense Hosted Email Security -- www.websense.com =

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110105/27f99=
b24/attachment.htm


More information about the Catalyst mailing list