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

105
Views
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
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!