Search code examples
jqueryjsonaemsightly

Fetch Json response in AEM sightly


I am working on a AEM component where my field data (drop down values, dynamic input values etc) is getting fetched from json file. This json is called from jquery ready function.

I am getting 404 error on my browser for this json response. I know AEM reserves the use of ".json" file, Is there a alternate way I can fetch these values ? the way my json is called as

jQuery(document).ready(function(){ <br>
DataAccessLayer.SetSomething("./data/myjsonFile.json");

});

Solution

  • as per discussion in comments

    I feel that your jsonfile is sth you keep statically within the component itself /app/yourapp/components/thecomponent/data/myjsonFile.json whilst your requesting something within your /content/yourapp section where this file is just not present

    answer

    moved my json data file inside the component folder and it worked