SweetPea::Application::Plugin::Ajax::Jquery - Generate Ajax requests and


SweetPea-Application documentation  | view source Contained in the SweetPea-Application distribution.

Index


NAME

Top

SweetPea::Application::Plugin::Ajax::Jquery - Generate Ajax requests and responses in jQuery using SweetPea-Application.

SYNOPSIS

Top

    ** NOT REAL CODE **

    ... from inside SweetPea::Application or a Controller;
    $s->ajax->request('/services/accounts', 'post', ['a > span', 'input']);
    or maybe
    get http://localhost/service/accounts id=12
    put http://localhost/service/accounts id=12 email=newone

    $s->ajax->function('login_checker', 'get', '/service/accounts');
    $s->ajax->script('tag');

    # generates the javascript code with or without the script tag
    # useful for hidding alot of methods [% s.ajax.script %]

    ... in html
    onclick="login_checker();"

METHODS

Top

new

    The new method instantiates a new SweetPea::Application::Plugin::Ajax::Jquery
    object which automatically generates the neccessary jQuery javascript code
    to submit a request to the appropriate Controller and Action. 

    $s->plug( 'ajax', sub { return SweetPea::Application::Plugin::Ajax::Jquery->new($s); });

AUTHOR

Top

Al Newkirk, <al.newkirk at awnstudio.com>


SweetPea-Application documentation  | view source Contained in the SweetPea-Application distribution.