我正在使用 Jasonette 将我的网站变成一个应用程序,但是在成功后我无法将 java 值传递给 javascript。我正在使用以下工作正常的代码:
JSON:
"actions": {
"$foreground": {
"type": "$reload"
},
"test_action": {
"type": "$util.banner2",
"success": {
"type": "$agent.request",
"options": {
"id": "$webcontainer",
"method": "testEcho"
}
}
}
Javascript:
$agent.trigger("test_action");
function testEcho(){
$('#wrapper').find('#test').css({'color':'red'});
}
爪哇:
JSONObject json_test_value=new JSONObject();
String test_value = "xpto";
json_test_value.put("value1", test_value);
JasonHelper.next("success", action, json_test_value, event, context);
成功后我想从java中获取test_value,以便能够使用testEcho(test_value)。这看起来很简单,但由于某种原因我做不到。