Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

jquery - Ajax Command to request URL no longer working

I just updated my cordova version. When I run

cordova -v

It outputs version 5.0.0

On the older version of Cordova I had (I actually don't remember what version that was) I was able to use AJAX to request data from a given URL. However, after updating the Cordova version, it no longer works. I have made no edit to the code after this update, so I'm guessing something in the new Cordova version is preventing requests from going through.

I have added the following access grants in my config.xml file:

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>

but still no luck.

Has anyone come across a similar issue? Any idea how I can get it working again?

Thanks,

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Turns out I was just missing the following plugin:

cordova-plugin-whitelist

After I installed it, rm the android platform, re-added the android platform, build and run, it worked!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...