Populate
- 授权协议: 未知
- 开发语言:
- 操作系统: 未知
- 软件首页: http://plugins.jquery.com/project/Populate
软件介绍
Populate a form or an element’s child elements using a JSON object.
This plugin supports full PHP naming and deep data structures, as well as checkbox arrays and other non-standard UI controls. The plugin can be used as part of your AJAX toolkit, or for separating server-side code from HTML by populating a form after the page has loaded eg:
$('form').populate({'text':'text', 'radio':1})
and not inline as the page is processed, such as:
<input type="text" name="text" id="text" value="<?php echo $text; ?>" />
<input type="radio" name="radio" id="radio-1" checked="<?php echo $val == 1; ?>" />
<input type="radio" name="radio" id="radio-2" checked="<?php echo $val == 2; ?>" />Non-form elements
You can also populate non-form controls such as <div>s, by specifiying the id and an identifying attribute (defaults to id):
$('div').populate({'text-1':'text', 'text-2':'More text'})
This can be useful when you want to show the results of a database call, but don't want the text to be editable.
Usage
Just include the PHP JSON class, PHP helper function and of course Populate at the top of your page, and a PHP snippet such as this the bottom:
<?php populate('form', $data); ?/>
Which will output something meaningful like this:
$('form').populate({'text':'text', 'radio':1})
Live Demo
Finally!
I've now FINALLY put up a full set of instructions and a working demo, with examples of:
- Populating a simple form, using string variable types for textfields, radiobuttons, dropdowns and checkboxes
- Populating a complex form, using array variable types for checkbox arrays and multi-list boxes
- Populating a hierarchical form, using hierarchical JSON data
View the jQuery Populate Demo here.
Download
JavaScript
PHP
数据资本时代
Viktor Mayer-Schnberger / 李晓霞、周涛 / 中信出版集团股份有限公司 / 2018-11-1 / CNY 58.00
【编辑推荐】 大数据除了能对我们的生活、工作、思维产生重大变革外,还能够做什么?畅销书《大数据时代》作者舍恩伯格在新书《数据资本时代》中,展示了大数据将如何从根本上改变经济——这并不是因为数据是一种新型石油,而是因为数据是一种新型润滑脂,它将给市场带来巨大能量,给公司带来巨大压力,使金融资本的作用大大削弱。赢家是市场,而并非资本。 这本书在当下国内出版,可以说恰逢其时。时下,中国经济正......一起来看看 《数据资本时代》 这本书的介绍吧!
