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

304
Vistas
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 Respuestas
Responde la pregunta

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 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