143
C0D4
5y

That sad sad moment you spot someone returning HTML in an ajax request 🥺

Why lord must you punish me?

Comments
  • 22
    oof single quotes aren't allowed in well formed json
  • 0
    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.
  • 2
    @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.
  • 0
    Kids, 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.
  • 3
    @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.
  • 1
    @TechNomad pffff, maybe *you* were a noob once, definitely not me!
  • 1
  • 0
    You made my COBOL dinosaur cry with this joke 🦕
  • 0
    That's like so 2000-and-late 🙄
  • 0
    Ever heard of PJAX?
  • 0
    @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.
Add Comment