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

107
Visualizações
How to show server response upon form submit?

I have a form, and when that form is submitted it sends an http post request to a php script which then perform the required calculations and echoes the result.

and currently I am just using a static content which shows that an action has been performed and its always the same string , now i am looking for a way to show the result that server echoes on the front end.

here is my current code :

Form Code:

<iframe name="dummyframe" id="dummyframe" style="display: none;"></iframe>  
<form action="calculate.php" method="post" target="dummyframe">
<div class="form-group">......................................
..............................................................</div>
<div class="form-group">
<input type="text" name="Lstring" class="form-control" id="Lstring">
<input onclick="assd()" type="submit" class="btnDoAction" value="Add" />
<p id="sses"></p>
</div>

I know if I don't use the dummy frame as target on form submit I can show the echo result either in the same tab or in a new one , but I actually want the response right below the submit button as text , where it's showing a static string at the moment .

and this is my JavaScript to show the message right below the Submit button:

<script>
function assd() {
  document.getElementById("sses").innerHTML = "Added!";
  setTimeout(function(){ document.getElementById('usersframe').contentWindow.location.reload(); }, 2000);
  
  setTimeout(function() {
    document.getElementById("sses").innerHTML = " "
  }, 2000)
}
</script> 

As you can see that it always shows the same word everytime the button was pressed so I was just wondering how to go about showing the response by the server below the Button where its currently showing the static string ?

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