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

193
Vistas
Is it okay show some ids in html?

Is it okay to generate HTML page like this:

...
<div id='some_id' lesson_id='313'>
 ...
</div>
...

And in jQuery just do

lesson_id = $("#some_id").attr("lesson_id")
// send some AJAX POST requests with this lesson_id

Is it normal way to pass some data to js from server side ?

Many thanks!

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Use the data attributes:

<div id="some_id" data-lesson_id="313">

then in jQuery get the value:

var lesson_id = $('#some_id').data('lesson_id');

More about .data(): https://api.jquery.com/jquery.data/

over 4 years ago · Santiago Trujillo Denunciar

0

So long as it doesn't reveal any major information that a malicious user can exploit, you can do that. As has been said, though, you should add the data-* attribute prefix, as this allows you to have custom HTML that's still considered valid.

over 4 years ago · Santiago Trujillo Denunciar

0

Use jQuery Data

<div id='some_id' data-lessonid='313'>
 ...
</div>

lesson_id = $("#some_id").data("lessonid")
over 4 years ago · Santiago Trujillo Denunciar
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