0
私は電話の隙間が新しく、AjaxをNode.jsサーバーに呼び出そうとしましたが、失敗しています。ここphonegap ajax call to express.js(ノード)
は私のNode.jsは
Server.jsはここ
var express = require('express')
,app = express()
app.get('/',function(req,res){
res.json('{fname:"fname",lname:"lname"}')
})
app.listen(process.env.PORT || 3015)
を提出シンプル急行コードである私のindex.html AJAX呼び出しはjqueryの
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://domainName:port/", //change according
success: function (data) {
alert(success)
},
error: function (e) {
alert('Error:');
}
});
})
</script>
を使用していますここに私のconfig.xmlです
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.testAndroid2.firstApp2"
versionCode = "1"
version = "1.0.0" >
<!-- versionCode is Android only -->
<!-- version is in major.minor.patch format -->
<name>PhoneGap Example App</name>
<description>
An example for phonegap build app which wont show up in the playstore.
</description>
<author href="https://YourWebsite.com" email="y[email protected]">
Name Of The Author
</author>
<access origin="*" />
<platform name="android">
<allow-intent href="market:*" />
<access origin="*" />
<allow-intent href="*" />
<allow-navigation href="*" />
</platform>
</widget>
(すなわちAJAXの問題はありません)アヤックスは、私はPhoneGapのビルドを使用して自分のアプリケーションを構築し、自分の携帯電話上でそれを実行したときに失敗しているが、同じアプリケーションは、私のPCの私のブラウザでは正常に動作しています。 私はphonegapに全く新しいので、私が何かのファイルを紛失しているかどうか教えてください。どんな助けもありがとう。