Showing results for 
Search instead for 
Did you mean: 

Frequency of API calls in Javascript


Back-end dev here. Writing a RESTFUL API that generates data to be used to generate real-time diagrams on the front end. I don't know jack about front-end or Javascript. However, I'm in a situation where I need to at least understand how this is going to be used. I did a little bit of searching around here looking for people with similar questions, but I'm in one of those situations where I literally know too little to even know what to ask properly.

If anybody is familiar with sankey diagrams, our front-end has one of those. Currently our web page (lets just call it index.html) has a javascript portion and that javascript portion points to a CSV file and generates the sankey from that csv.

I've been tasked to write an api that generates the info the sankey needs, and outputs a json. Then the javascript in index.html will be changed to instead of pointing to the csv file, point to my api using d3.json().

What I don't really understand is, how frequently would this be updated? Like, if javascript exists inside of an html page, how often is the script "run". So the api I'm writing generates the data from info on a database. If someone updates the database (or rather, adds new info relevant to the sankey), will the sankey be updated right away? Does the javascript get run 1 time every time someone opens index.html? Or what?

I know this isn't my best formatted question on here. Its just not something I have the knowledge of how to search.


 want to delimit to only posts with "ssdi" in title. I read the api documentation, and found the term TITLE which apparently tells it to only search title. I tried adding "&title" to the end of the URL, but it yielded same result as code box above. Could you advise how I should add TITLE to the URL so that it only outputs results for this azar  echatspin  keyword in title?