Ajax调用本地csv文件

The folder structure is: HOME\htmlhelp\wwhelp\wwhimpl\js\scripts HOME\auxi\

I can read a csv file (located in the HOME\htmlhelp dir) from a js file located in the HOME\htmlhelp\wwhelp\wwhimpl\js\scripts dir using the following: var file_path="../../../../../htmlhelp/rule_mapping.csv";

However, the same js file (from the same location) cannot read the same csv file in the HOME\auxi\ directory! Am using the path as var file_path="../../../../../auxi/rule_mapping.csv";

It throws an "NS_ERROR_DOM_BAD_URI: Access to restricted URI denied" error. I have checked the file permissions and stuff but no luck. Any help would be appreciated.

The problem lies within:

var file_path="../../../../../htmlhelp/rule_mapping.csv";

It's not possible to traverse up to paths out of the root directory where the document is located.

Assuming you work under UNIX (Linux/Mac), one solution would be to create a symbolic link on the root directory of the document, such as (executing from the scripts directory):

ln -s ../../../../../htmlhelp/rule_mapping.csv rule_mapping.csv

And changing the file_path to:

var file_path="./rule_mapping.csv";

I hope this helps!