0

我使用带有扩展名 *.BAR 的 Eclipse 插件为智能手机 BB10 转换并部署了一个 Android 应用程序。它是一个混合应用程序,包含一个应用内浏览器和一个使用 HTML、CSS 和 jQuery 的应用程序。它适用于 BB10 之前的 Android、iPhone 和 BB。

我使用 jQuery 执行 AJAX CROSSDOMAIN 请求,如下所示:

$.ajax({
    type: "POST",
    url: "http://***************************.json",
    datatype: "json",
    crossDomain: "true",
    contentType: "application/json",
    data:'{"technicalNumber":"********","password":"****"}',
    scriptCharset: "utf-8",
    success : function(data) {
        // do stuff
    },
    error: function(object, status, error){
        // do other stuff
        alert(error);
    }
});

此 POST 调用在不同的域上,受 CORS 概念的约束,并且首先发送预检 OPTIONS 请求。对此查询的回复返回 XML OPTIONS(没有值),它被解释并在 parseError jQuery 处引发类型错误。

错误:http: //img11.hostingpics.net/pics/164967Photo1.jpg

在所有其他移动平台上,不会解释预检请求 (OPTIONS)。如何在 BB10 上不解释 AJAX 中的预检?

4

1 回答 1

1

I solved my problem, finally i didn't use the tool who's convert android app to bb10 app (BAR). I used webworks (http://developer.blackberry.com/html5/) I just took my html, css, and js files from my android web app, add some lines to the headers, package and compile it, and it was working on my bb10!

于 2014-02-27T13:25:29.573 回答