javascript - Add local json file to rails app and use $.getJSON to get it locally -
I get JSON data using a local, stable JSON file in my Rail app and then using So far I tried to add it to $ Trying to do .getJSON inside the second javascript file in the same rail app.
assets / javascripts / and
public / and then
bundle app rake objects: precompile < / Code> is running, though I still have not successfully loaded the JSON file in my second JavaScript file. You must be able to install a static JSON file in the public directory and load it directly.
static.json in the
public directory, you need to load it:
$. GetJSON ('/ Static.json', function (data) {console.debug (data);});
Comments
Post a Comment