Error loading json

0

How about! I am using an api called jquery Mapael for the creation of interactive maps in html, I am loading the data from a json to the application, here is the code:

$(function () {
        $(".mapcontainer span").html("Loading JSON data").css({"color":"blue", "font-weight":"bold"});
        setTimeout(function(){
            $.getJSON("import_from_json_file.json", function (data) {
                //Codigo bla bla bla...
            }).fail(function() {
                // Error
                $(".mapcontainer span").html("Failed to load JSON data").css({"color":"red"});
            });
        }, 200);
    });

However, the error I get when loading the json, throws me the error, and I did the following to solve it and nothing

-Change "import_from_json_file.json" with './import_from_json_file.json'

-I put the full path to the file, something like this: "C: /gatitos/cafeCargado/import_from_json_file.json"

-I valued the json in jasonlint

I read that you have to configure a web.config to read it, but I'm not adding a server or anything like that, everything is local

    
asked by Juan Trinidad Mayo 24.10.2017 в 01:16
source

1 answer

0

Instead of putting:

C:/gatitos/cafeCargado/import_from_json_file.json

Coke forward file:/// , It would stay like this:

file:///C:/gatitos/cafeCargado/import_from_json_file.json

    
answered by 24.10.2017 в 02:09