If you're looking for a file in your local assets, this url is most likely not correct:
Where is the file located, relatively to the current html document?
the file is in the info folder inside my project folder... i dont think the problem is my code, i think am not building the apk correctly or am missing a plugin for PhoneGap or my config.xml file is missing something
i dont think the problem is my code
Why don't you think so?
i think am not building the apk correctly
Are you building locally or using PGB? If the latter, are there any error messages in your build log?
am missing a plugin for PhoneGap
Which one would that be?
or my config.xml file is missing something
Yes, or your CSP, or something else...
but "the file is in the info folder inside my project folder" doesn't completely answer my question, because you didnt mention where the 'current document' is located.
fwiw, my guess is that you should have either 'info/animal.txt' or '../info/animal.txt' for the url, depending on your assets structure.
The animal. txt is located in my project folder in the www folder.. the file is in the right place because it works fine when i use the phone gap desktop app but when i build the app using build.phonegap it doesn't work
Can you show me how to set up my CSP. All of my files are local
Don't assume that because something works with the PhoneGap Desktop/Developer apps that it will work when building using PGB/CLI. There are edge cases there, and CSP/whitelisting is one.
Please share your config.xml (minus identifying/secret information) and your CSP meta tag (if present). Also, add error handling to your AJAX call and share any errors you receive.
I dont have a meta CSP tag but i will show you my config.xml file.
<?xml version='1.0' encoding='utf-8'?>
A basic Framework7 template for PhoneGap.
<content src="index.html" />
<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:*" />
<preference name="android-minSdkVersion" value="14" />
<allow-intent href="market:*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<preference name="BackupWebStorage" value="none" />
<preference name="DisallowOverscroll" value="true" />
<plugin name="cordova-plugin-whitelist" spec="~1.2.0" />
<plugin name="cordova-plugin-console" spec="~1.0.1" />
<plugin name="cordova-plugin-statusbar" spec="~1.0.1" />
OH ---- I see it. Goodness, I'm blind today.
You're trying to fetch from the root of the device -- the file will obviously not be present. Remove the beginning "/" or replace with "./" instead. So either one of the following should work:
Thank you thank thank you and again thank you
Didn't I say so 4 days ago already?