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

305
Visualizações
Using form.submit() in client side GAS to transfer data to localhost

I'm trying to create a pop-up browswer in GAS. What I wanna do here is post some value to my local api and get response from it. My code below doesn't work as I meant to and it's stuck in the screen in the picture. Api doesn't get any request meaning post is not working successfully. Any advice will be appreciated.

  if (cell_tick == true) {
    var tick_row = cell_pos.getRow();
    var date = new Date();
    sheet.getRange(tick_row, date_column).setValue(date).setNumberFormat('yyyy/MM/dd H:mm:ss'); 
    
    openTab()
    function openTab() {
    var js = "<script language='JavaScript'>\
    function openWindow()\
    {\
    myWindow = window.open('about:blank','theWindow','width=400,height=400');\
    }\
    </script>\
    <form method='POST' name='myForm' action='http://127.0.0.1:5000/' target='theWindow'>\
    <input type='text'>\
    <input type='button' onERASETHISClick='openWindow(); document.myForm.submit()' value='Open and after submit'>\
    </form>;\
    "
    var html = HtmlService.createHtmlOutput(js)
      //.setHeight(10)
      //.setWidth(100);
    SpreadsheetApp.getUi().showModalDialog(html, 'Now loading.');
    }
  }

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your form is in an iFrame, it basically exists in the internet on some server somewhere. It cannot post to localhost because that address is not public, it is local to your router. A good way to start is to read how client (the form) and the server (the app) can communicate with each other here.

about 4 years ago · Juan Pablo Isaza Relatório
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