The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

    ** 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

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

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