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*
-
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.Ozair Kafray– Ozair Kafray2013-09-14 19:31:04 +00:00Commented 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.James– James2013-09-15 09:38:32 +00:00Commented 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)?Ben Lee– Ben Lee2013-09-17 01:06:45 +00:00Commented 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.Ben Lee– Ben Lee2013-09-17 01:07:15 +00:00Commented 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.James– James2013-09-17 08:23:01 +00:00Commented Sep 17, 2013 at 8:23
Add a comment
|
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you