The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

LEGAL

#===========================================================================

Copyright (C) 2008 by Nik Ogura. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Bug reports and comments to nik.ogura@gmail.com.

#===========================================================================

NAME

CGI::Lazy::Ajax

SYNOPSIS

        use CGI::Lazy;

        my $q = CGI::Lazy->new('/path/to/config');

        my $widget = $q->ajax->dataset({...});

DESCRIPTION

CGI::Lazy::Ajax is an abstract class for the Lazy Ajax widgets such as Dataset, Composite, and Domloader.

Its methods are called internally by its child classes. There are, at present, no real uses for the class by itself.

METHODS

ajaxReturn ( widgets, data )

Wraps data (presumably from widget) in json format with validator from widgets for returning to browser in response to an ajax reqeust

widgets

List of widgets to be parsed for validators

data

Widget html output

ajaxSelect (args)

Runs select based on args and returns output. By default will be sans enclosing div tags, but div can be included if you pass div => 1. This is useful for children of composite widgets.

args

Hash of select parameters

jsonescape ( var )

traverses variable and strips out single quotes to prevent JSON parser blowing up.

Strips them out rather than escaping them, as at present I can't figure out how to just add a single fracking backslash to them. s/'/\\'/g gives 2 backslashes, and s/'/\'/g gives none. grr. problem seems to be in either JSON or JSONPARSER

var

whatever variable you're going to convert to json and then parse

preloadLookup

Runs queries for lookup tables and parses then into JSON wrapped in javascript suitable for loading into the DOM of a page.

Useful only for tables that are intended to be preloaded into a page at load.

ajaxBlank ()

Convenience method. Returns blank widget output