访问拒绝PHP从黑莓10平台使用phonegap - 关闭 [英] access denied to PHP from Blackberry 10 platform using phonegap - closed

查看:224
本文介绍了访问拒绝PHP从黑莓10平台使用phonegap - 关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我的phonegap项目工作在黑莓模拟器。版本是10。



当我说phonegap,我没有使用任何Cordova功能,但我的简单的javascript函数不工作的第一位。 >

我有一个按钮点击,调用一个Javascript函数。这个JS函数有一个PHP作为URL来检索数据。以下是函数代码 -

  function getAllDetails(){
var myTable ='';
myTable + ='< table id =myTablecellspacing = 0 cellpadding = 2 border = 1>';
myTable + =< tr>< td>< b> S.No.< / b>< / td>< td>< b>全名< / b& / td>< b>< / b>< / td>< td>< b>地址< / b>< b>< / b>< / tr>; b>< / td>< / b>
var url =http://XXX.XXX.XX.XX:XX / PG_crud_experiment1 / retrieve_all.php;
$ .getJSON(url,function(json){
$ .each(json,function(i,v){
alert(v.id);
myTable + < tr>< td>+ v.id +< / td>< td>
+ v.name +< / td>< td>+ v.dob
+< / td>< td>+ v.address +< / td>< td>
+ v.image +< / td> tr>;
});

$(#emp_tb1)。html(myTable);
}
};

这里的问题是我的按钮点击进入Javascript函数,但我收到一个错误,说它不能访问放置我的PHP文件的URL。 PHP实际上是运行SELECT SQL并从数据库中检索值。



下面是我在BB 10模拟器上的错误的截图。



任何人都可以告诉我为什么这个问题出现了?在设备可以运行某些Javascript函数或访问服务器上的PHP脚本之前,是否需要遵循任何先决条件/程序?XXX

解决方案

解决方案是编辑项目的config.xml文件 -
添加标签< access subdomains =trueuri =http:// * URI name here */> 。只有这样,Blackberry才允许访问其他域的访问权限。


I have a problem with my phonegap project working on blackberry simulator. The version is 10.

When I say phonegap, I haven't used any Cordova features yet but my simple javascript functions are not working in the first place.

I have a button click which invokes a Javascript function. This JS function has a PHP as URL to retrieve data. Following is the function code -

function getAllDetails() {
  var myTable = '';
    myTable += '<table id="myTable" cellspacing=0 cellpadding=2 border=1>';
    myTable += "<tr><td><b>S.No.</b></td><td><b>Full Name</b></td><td><b>DOB</b></td><td><b>Gender</b></td><td><b>Address</b></td><td><b>Image</b></td><td><b>Video</b></td></tr>";
    var url = "http://XXX.XXX.XX.XX:XX/PG_crud_experiment1/retrieve_all.php";
    $.getJSON(url, function(json) {
                $.each(json, function(i, v) {
                    alert(v.id);
                            myTable += "<tr><td>" + v.id + "</td><td>"
                                    + v.name + "</td><td>" + v.dob
                                    + "</td><td>" + v.address + "</td><td>"
                                    + v.image + "</td></tr>";
                        });

                $("#emp_tb1").html(myTable);
            });
};

The problem here is my button click is entering the Javascript function but I am getting an error saying it cannot access the URL where my PHP file is placed. The PHP is actually running a SELECT SQL and retrieving values from a database.

Below is a screenshot of my error on BB 10 simulator.

Can anyone please tell me why this problem is coming up? Are there any pre-requisites/procedures to be followed before the device can run some Javascript functions or to access the PHP scripts on server?XXX

解决方案

The solution is to edit the config.xml file of the project - add the tag <access subdomains="true" uri="http://*URI name here*"/>. Only then, Blackberry allows access permissions to a different domain.

这篇关于访问拒绝PHP从黑莓10平台使用phonegap - 关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆