开发者

Reload page from CGI?

开发者 https://www.devze.com 2023-03-01 12:43 出处:网络
I have a form that looks like this <form action=\"/receiver.pl\" method=\"post\"> </form> Clicking on the submit button doesn\'t take开发者_开发百科 the user to a new page, because of s

I have a form that looks like this

<form action="/receiver.pl" method="post">
</form>

Clicking on the submit button doesn't take开发者_开发百科 the user to a new page, because of some JQuery that can be seen here.

Is it possible in receiver.pl to reload the current page?

What receiver.pl is doing is processing some data that is shown on the current page, where the submit button is.

So it would be really cool if the page could be reloaded, so the changes could be seen right away.


Receiver wouldn't do that. What you'd do is this:

  1. jQuery makes an AJAX call to receiver.pl
  2. Receiver.pl does its thing and returns a valid JSON string to jQuery.
  3. jQuery then reloads the page or alters the page based on the content of the JSON results.

The CGI itself cannot reload a page once it's already been loaded.


No. A server side process can only return data to the client. The client has to initiate reloading the page. This would normally happen when the form was submitted, but the JavaScript is intercepting that action and replacing it.

It sounds like the solution is "Remove the JavaScript that is stopping normal form submission".

0

精彩评论

暂无评论...
验证码 换一张
取 消