[Catalyst] Ajax Problem.

Eden Cardim edencardim at gmail.com
Thu Jan 6 16:31:01 GMT 2011

>>>>> "Rohan" == Rohan M <rohan7799 at gmail.com> writes:

    Rohan> Dear All,
    Rohan> I want to use Ajax in my Catalyst application.

    Rohan> Thing's that I've done till now :

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

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

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

There's not much difference in how Catalyst handles Ajax, all it sees
are normal HTTP requests. You just have to take care to serve the
correct content for each request. Typically, you'll have a controller
action for loading the HTML/JS structure and a set of supplementary
actions to render the partials.

    Rohan> Or Will I need to parse the entire content?

It depends on what response you build inside catalyst, for partials you
want to not render the <html><body> etc. tags, since you're going to
update the document via innerHTML.

For implementation specifics you're going to have to show your catalyst

     Eden Cardim            Need help with your perl Catalyst or DBIx::Class project?
   Software Engineer                   http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.        Want a managed development or deployment platform?
http://blog.edencardim.com             http://www.shadowcat.co.uk/servers/

More information about the Catalyst mailing list