Skip to content

Instantly share code, notes, and snippets.

@ggendre
Created July 12, 2013 15:57
Show Gist options
  • Save ggendre/5985526 to your computer and use it in GitHub Desktop.
Save ggendre/5985526 to your computer and use it in GitHub Desktop.
a raw (maybe not working) example on how to send back and forth ajax informations to BB10 qml native side
//fix BB10 ajax calls with a native patch
var lib=window.Zepto || window.jQuery;
lib.ajax=function(options){
navigator.cascades.postMessage(JSON.stringify({ action:"ajax", options:options }));
navigator.cascades.onmessage = function(message){
var params=JSON.parse(message);
if (params.action=="ajaxCallback"){
if (params.success && options.success){
options.success(params.data);
}else if (params.error){
options.error(params.req, params.err);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment