[英]Passing json from one Backbone view to another
can you please explain how can i return dynamic json from one view to another? 您能解释一下如何从一个视图返回动态json到另一个视图吗? in first view i generate json.push like this:
在第一个视图中,我这样生成json.push:
json.push({
first: value,
second: value
});
Maybe jQuery events would be useful for this? 也许jQuery事件对此有用吗? For example:
例如:
View 1: 查看1:
$(document).on("someEvent", function() {
// some handler code here
});
View 2: 查看2:
$(document).triggerHandler("someEvent", [{
first: value,
second: value
}]);
View 1 查看1
$("body").trigger( "return", {})
View 2 查看2
$( "body" ).on( "return", function( event, o ) {})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.