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

154
Vistas
how to get button tag from ajax response on html in javascripts

Propose : get or select tag button with javascripts after ajax showing all data,

Issue : I can't get the button affter ajax respond.

Description : I use javascript and select button with id = "btn_infor" use querySelectorAll(), but when I was selecting, the data not found and my variabel Nodelists have nothing.

Javascript(Ajax) :

function get_databyvisibility(num,variabels){
        visible = num
        $.ajax({
            type:'GET',
            url:`/post-jsondata/${visible}/`,
            dataType:'json',
            success: function(response){
                variabels(response.data)
            },
            error: function(error){
                console.log(error)
            }
        })

Then I use this function to show data to html.

function call_datas(result){
        result.map(post =>{
            more_procudt.innerHTML += `
                <div class="product-box">
                    <img src="${post.image_urls}" alt="" class="product-img" id="more-imgpro">
                    <h2 class="product-title" id="more-titlepro">${post.name}</h2>
                    <span class="price" id="more-pricepro">$${post.price}</span>
                    <div class="detail-info">
                        <button class="but-info" id="btn_infor">Detail</button>
                    </div>
                </div>
            `
        })

I call the function : get_databyvisibility(4,call_datas)

after I call the function and then I use this code to select this tag " <button class="but-info" id="btn_infor">Detail</button>"

This the code to select all button : const button_information = document.querySelectorAll("btn_infor");

After I select all buttons my variable has nothing nodelist.

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