Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 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 Answer

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...