wet-boew / GCWeb

Canada.ca theme - A reference implementation of the Canada.ca Content and Information Architecture Specification, the Canada.ca Content Style Guide and the Canada.ca Design System
https://wet-boew.github.io/GCWeb/
Other
91 stars 128 forks source link

DataJSON not firing? #1376

Open suzannely opened 6 years ago

suzannely commented 6 years ago

Hello,

I am having trouble making DataJSON work on my local. I have all WET files loaded and I even used the JSON file provided for the DataJSON working example but it is simply not firing. There are no errors in the console.

I tested Data ajaxing in a page and it worked but DataJSON is not working at all.

My code is below.

<ul class="lst-spcd" data-wb-json='{
        "url": "sample.json#/anArray/2",
        "queryall": "li",
        "mapping": "/@value"
    }'>
                <template>
                    <li></li>
                </template>
            </ul>

Any advice provided would be much appreciated.

duboisp commented 6 years ago

Browser usually block ajax query made by a file running directly from the local file system. Instead you need to access it through a local HTTP web server like IIS or Apache.

What is the JSON content of your sample.json file? Is it a well formed JSON? Did you see any error in your browser console?