interest behavior of json in rails

Hi,
I'm working on rails project where I use json file for storing some
data.
Basically data are stored and get using ajax calls from jquery.

But there are some strange issues.
For example, when I add data in json file using AJAX and then open file
in Chrome: localhost:3000/example.json there are no data. I open the
file in firefox and data exists. When i refresh file in Chrome there are
data. Sometimes data is inserted correctly. Maybe it could be browser
cache issue?

I know that AJAX is asynchronous but sometimes there are few refreshes
needed for data to be added- JSON file is in public folder and I'm
adding data from rails controller like this is txt file. I just convert
hash to json and insert json in file like it's txt file.

What can be problem here?
How can I make inserting and reading data in json file works correctly?
If I'm not clear, I can exaplain this better, just say.

I appreciate any kind of help

What does your log says? can you put here some of it for each browser?

Javier Q

Hi,

thanks for reply. I will put log tomorrow from my office. It is userful
to say that before this json files was in assets folder and everything
worked fine. Then i delete files from assets and put it in public folder
and of course chnaged application top get files from public folder not
from assets.

And then this problem begin to happens

And it works fine on localhost it just make problems on production
server