Mr.Robot
Mr.Robot

Reputation: 529

I want to include the xml file inside the javascript file in my INTEL XDK Project

Im doing a hybrid application through INTEL XDK.

Upvotes: 0

Views: 213

Answers (2)

xmnboy
xmnboy

Reputation: 2310

Within a Cordova app (which is what the XDK creates) you cannot use absolute paths to point to the location of the html file, it doesn't work as you might expect in a Cordova webview. You have to use relative paths to address any files. The www directory is the "root" of your project.

Your index.html file is located at the top of the www directory, as shown in your directory tree snapshot, which I assume you got from the Brackets editor that is built into the XDK:

www/index.html

And your xml file is located here:

www/js/Exact.xml

So, given the above locations and conditions, we need a slight modification to @Jaromanda's answer:

var xmlDoc = loadXMLDoc('js/Exact.xml')

Upvotes: 1

Jaromanda X
Jaromanda X

Reputation: 1

Your xml file is

www/js/Exact.xml

You're trying to access it from

www/xdk/index.html

One thing to try is

var xmlDoc = laodXMLDoc('../js/Exact.xml');

or, if www is the "root" of a web server

var xmlDoc = laodXMLDoc('/js/Exact.xml');

Otherwise, you're on your own

Upvotes: 0

Related Questions