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 $ Trying to do .getJSON inside the second javascript file in the same rail app.

So far I tried to add it to 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

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -