Mel said:
how can i return "HTTP status code 204" from my cgi script ?
How about looking in the documentation of your favourite CGI
language/package on how to set HTTP response codes?
As you are asking in a JavaScript group I will show you an ASP solution
with JavaScript, if that doesn't help you then use an appropriate group
for your server side language, after checking its documentation and FAQ
list.
<%@ Language="JavaScript" %>
<%
function checkForUpdates () {
// simply returning a number here
return Math.floor(Math.random() * 10) + 1;
}
var update = checkForUpdates();
if (update < 5 && Request.ServerVariables('REQUEST_METHOD') == 'POST') {
Response.Status = '204 No Content';
Response.End();
}
%>
<html lang="en">
<head>
<title>form updated occasionally</title>
</head>
<body>
<form action="" method="POST">
<div>
<label>
user value:
<input type="text" name="uservalue">
</label>
<input type="submit" value="check for updates">
</div>
<div>
<span>
updated value:
<%= update %>
</span>
</div>
</form>
</body>
</html>