Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

447
Visualizações
window.open() on ajax query has error in console:Uncaught (in promise) Error: Cannot read properties of undefined (reading 'allowlisted')

I'm opening a popup window after an click on my main page using jquery. The pop up window has a button that should call a function on click. Unfortunately, the opened window shows an error in the console. I should note that if I attach the window.close() function to my button, the console still shows the error but the button does close the window so perhaps I have multiple problems in my code.

JS:

function jb_log_js(jb) {
  console.log("jb_log_js lancée");
  $.ajax({type: 'POST',
  url: "http://127.0.0.1:5000/jb_log", 
  data: JSON.stringify(jb),
  success:function(data){console.log("jb_log_js callback");
  var win = window.open("", "Title", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=200,top="+(screen.height-400)+",left="+(screen.width-840));
  win.document.body.innerHTML = data;},
  contentType: 'application/json',
  dataType : 'json',
}
  );
  console.log("jb_log_js finie");
}

Python Flask:

@app.route('/jb_log',methods=['GET','POST'])
def jb_log_py():
    print("jb_log_py lancée")
    if request.method == 'POST':
        print("entrée if")
        print(request.is_json)
        print(request.get_json(force=True))
        liste_jb= request.get_json(force=True)
        print(liste_jb)
        template = render_template('jb_log.html',title="connexion",liste_jb = liste_jb)
        return json.dumps(template)

HTML:

<!DOCTYPE html>
<html>
<head>
<script src="{{ url_for('static', filename='jquery-3.6.0.js')}}"></script>
<script src="{{ url_for('static', filename='script.js')}}"></script>
</head>
<body>
    <div>
        <form>
            {% for jb in liste_jb %}
                <label for="identifiant">Identifiant pour {{jb}}:</label><br>
                <input type="text" id="identifiant" name="{{jb}}"><br>
                <label for="mdp">Mot de passe pour {{jb}}:</label><br>
                <input type="text" id="mdp" name = {{jb}}><br>
            {% endfor %}
            <input type="button" value="Valider" onclick="lancement_scraping()">
        </form>
    </div>
</body>

The console

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda