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

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