开发者

Why this jquery code is not working on blackberry?

开发者 https://www.devze.com 2023-04-10 09:51 出处:网络
I am developing phonegap app using jquerymobile. but in blackberry 9780 it does not show me alert, my code is

I am developing phonegap app using jquerymobile.

but in blackberry 9780 it does not show me alert, my code is

document.addEventListener('deviceready', run, false);

function run(){
            $.getJSON开发者_如何学C('http://twitter.com/users/usejquery.json?callback=?', function(json){  

                alert(json.followers_count); // not displaying in blackberry
            });
        }

My head part is :

        <script src="phonegap.js">
        </script>
        <script src="jquery1.6.2.js">
        </script>
        <script src="jquery.mobile1.0b3.js">

It works fine in other mobiles like Android,iphone,ipad and also working on my Mozzila browser 8.0 but not working on blackberry OS 6.

Please help me.

Thanks


1st make sure that run() is getting executed, if not, then try attachEvent element.attachEvent('ondeviceready',run)

Edit

refer

JQuery JSONP cross domain call not doing anything and jQuery, JSON and Apache problem


A few things:

  1. there is a new version of jqm, the v1.0 RC1, try to work with this one.
  2. Use the Ripple Emulator from RIM to test more quiccly the app, is a Chrome broser plugin.

And the most important:

deviceready needs:

  1. in your body make this: <body onLoad='initSO()'>

then in the header, after loading: json2.js, phongap, jquery, jquerymobile... put this

function initSO() {
            console.log('initSO()');
           document.addEventListener("deviceready", onDeviceReadySO, true); 
}

function onDeviceReadySO() {
console.log('hello word :D ');
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号