Uncaught Error: Syntax error, unrecognized expression: #botao_resp _? = $ row ['id']?

0

I have a page with forms to answer questions and I'm trying to use jquery in a separate file and it's giving the following error: Uncaught Error: Syntax error, unrecognized expression: #botao_resp _

$("#botao_resp_<?=$row['id']?>").on('click', function (event) {
event.preventDefault();
alert('Você clicou no botão!');

$.ajax({
    method: 'POST',
    url : 'banco-responder.php',
    data: {
    id : $("#id-resposta-<?=$row['id']?>").val() ,
    resposta : $("#resposta-pergunta-<?=$row['id']?>").val()
}
    }).done(function(data){
    console.log($("#card-<?=$row['id']?>").hide());
    alert("Respondido com Sucesso!");
    }).fail(function(){
    alert('Deu pau');
    });
return false;

});

In the Forms ID attribute is completed by a variable, which comes from the iteration an array. When I put this code in the same forms file, it works. But when I import it from another file it does not work.

    
asked by anonymous 29.01.2018 / 11:39

0 answers