Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • You should get html from the server. The html should request data using ajax requests to the api once its loaded. The api and html can be located within same webroot or different. You sshould think about structuring it as if they come from different urls. Commented Sep 14, 2013 at 19:31
  • I think you might have misunderstood my question. My page is already rendered, I'm making an API call to get user location data for the map. However I also want to render that location data as a HTML list on the page, without making another API call, and without pulling down the HTML in the original call. Commented Sep 15, 2013 at 9:38
  • @James, what is your reasoning for not wanting to pull down the HTML for this list in the original page call? Is the feature only used some of the time and the time to build the list significant (in other words, do you want only want to build the html for the list on-demand to increase general performance)? Or is there some constraint that requires the html to built at the time of the request (e.g. because the list is dynamic and you want it to be most up-to-date, or because it requires some additional input from the user only available on the page)? Commented Sep 17, 2013 at 1:06
  • I ask these questions because if the html is static between page load time and api request time, and not expensive to build, a good solution is to just return it with the initial page load as Ozair recommended. I want to get a better sense of your constraints to better answer the question. Commented Sep 17, 2013 at 1:07
  • Ah, sorry I may not have been as clear as possible in my question. I'm not talking about the original page request. Rather, I'm talking about every time the user updates (adjusts bounds etc) the map, I want new markers to be placed based on the bounds, and the HTML list to update to reflect these changes (the latter reason you suggested). It makes sense to me to return the location data and HTML in one easy API call, but I'm not sure if this is "best" practice based on separation of concerns. Commented Sep 17, 2013 at 8:23