Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Aren't a lot of ajax requests returning xml? This seems like a stupid ignorant cartoon. What a request returns is really up to the dev of the system. Yes json is convenient, but it doesn't have support for some data types and may not represent what you want efficiently.
-
C0D4681465y@Demolishun yea back when ajax first came to be a thing. That went to JSON with structured data as it was easier to work with and you let the front end parse and build the necessary container.
-
matste6455yKids, that’s what we used to do in 2005. We sent html embedded in XML inside a Json response. Sometimes there was even a javascript inside the html fragment.
Fuck JSF. -
C0D4681465y@TechNomad this isn't about a cms with embedded HTML for rich text areas. Those cases can't be avoided.
This is about changing a hard coded element from the front end pushing it to the server side and then bringing it back as it was without changing anything beyond strapping a xhttp.open() into the JS and adding a getElementById().innerHTML(response)
Which is exactly what is happening in this image. -
Trexus183585y@Demolishun eh, I think returning hard HTML is probably not too great of an idea.
Generally you're probably going to want to let the front end formal the data, not the server side, so that you can use the same API on multiple pages, or if you need to make changes to front end you don't have to edit server code.
Granted, if you have a pretty good idea of where the payload is going to land, it might be more convenient.
Related Rants
That sad sad moment you spot someone returning HTML in an ajax request 🥺
Why lord must you punish me?
joke/meme
html
sad but true
javascript
kill me
responses
production
ajax