I am in the process of creating a CGI script that performs various functions. I am striving to maintain simplicity and portability within the script. My main objective is to provide users with a way to send a message to the server without losing the current page. Here is my proposed method:
- The user accesses a "status page" generated by the CGI script.
- This status page includes a JavaScript timer that retrieves specific data from the server every two seconds, updating the status page accordingly.
- When the user clicks on a hyperlink element, it triggers the initiation of a task on the server.
- The CGI script receives the parameters from the click event and commences the task.
- The CGI script sends back a response containing
\n
.
However, upon reaching this point, Firefox prompts the user to download the CGI script, which only contains the newline character (\n
) sent by the CGI script. I want the browser to simply disregard this response without any interruptions. If the CGI script does not echo a \n
, Apache returns an error. Is there a way to instruct the browser to ignore the response and remain on the current page? Re-loading the current page is not preferred in this scenario. Perhaps there exists an HTTP response akin to a "noop" for such situations?