Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
Dangers of client-side HTML generation from AJAX JSON response?

So I'm having a website which uses a couple of AJAX requests which fetch data from the DB in an array in PHP, and then generate the markup accordingly needed on the frontend within PHP, then deliver that to the client, and insert it into the DOM using js (simple targetElement.innerHTML = responseFromServer principle).

What I want to do now to be more compatible with non-web interfaces (such as ios and android apps) is adapt these AJAX calls to exclusively output JSON responses. And consequently change the js client-side code to generate the according markup upon reception, with stuff like createElement(), appendChild(), etc. In this case, some people told me that this could be dangerous, in terms of the security of the webapp. I could not understand these reasons; so what are the risks of generating HTML content on the client-side in js, using a JSON response, instead of directly inserting a thus on-the-server-generated-HTML into the DOM?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda