Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!