1.事件派发:子控件->父控件
message : { { message | json }}
2.事件广播:父控件->子控件
- 录入内容:{ { item }}
3.ajax
ajax-helper.js
function AjaxHelper() { this.ajax = function(url, type, dataType, data, callback) { $.ajax({ url: url, type: type, dataType: dataType, data: data, success: callback, error: function(xhr, errorType, error) { // alert('Ajax request error, errorType: ' + errorType + ', error: ' + error) console.log('Ajax request error, errorType: ' + errorType + ', error: ' + error); } }) }}AjaxHelper.prototype.get = function(url, data, callback) { this.ajax(url, 'GET', 'json', data, callback)}AjaxHelper.prototype.post = function(url, data, callback) { this.ajax(url, 'POST', 'json', data, callback)}AjaxHelper.prototype.put = function(url, data, callback) { this.ajax(url, 'PUT', 'json', data, callback)}AjaxHelper.prototype.delete = function(url, data, callback) { this.ajax(url, 'DELETE', 'json', data, callback)}AjaxHelper.prototype.jsonp = function(url, data, callback) { this.ajax(url, 'GET', 'jsonp', data, callback)}AjaxHelper.prototype.constructor = AjaxHelper
server.php
'keenleung', 'age'=>25), array('name'=>'keenleung2', 'age'=>26), ); $data = $people;}echo json_encode(array( 'status' => 'success', 'data' => $data));
html
姓名 年龄 { { row.name }} { { row.age }}