Hi,
I am following the example from http://developer.yahoo.com/cocktails/mojito/docs/topics/mojito_run_dyn_defined_mojits.html#example-two. It works fine on server side with node. However when I build it into html5 app using "mojito build html5app". mojitoProxy.invoke won't work as it will trigger a POST request to local file system.
Below the code to invoke mojit from binder. The goal is to embed the offline build into a mobile app (all the logic and ui can be done without node).
Can anyone suggest a solution?
YUI.add('ParentMojitBinderIndex', function(Y, NAME) {
Y.namespace('mojito.binders')[NAME] = {
init: function(mojitProxy) {
this.mojitProxy = mojitProxy;
},
bind: function(node) {
this.node = node;
Y.one("#btndispatch").on("click", function (e) {
this.mojitProxy.invoke("dispatch", {}, this.dispatchCallback);
}, this);
},
dispatchCallback: function(error, data, meta) {
if (error) {
alert("error dispatching mojit :: " + Y.JSON.stringify(error));
} else {
Y.one("#output").append(data);
}
}
};
}, '0.0.1', {requires: ['mojito-client']});