Hi,
I am having C function. From the html page, through ajaxcall the request is passed and the response is got.
If I perform some action like click submit button, then some action will be performed. How to get back to the same html page after redirection?
Can I set the environment variable which automatically redirects me to that page?
EDIT: Adding more detail from 'answer' below
Thank you Roe.
As I am new to this I am not able to get it. If we are using php then I can get the URL and put it in the header("Location:".$url).
But I am having only C functions.
HTML Code
function x(id)
{
var val;
var URL = window.location.href;
if(id =="y")
{
val=1;
document.location = "http://ipaddr/cgi-bin/file.cgi?value="+val+"&url="+URL;
}
}
C Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
printf("Content-type: text/html; charset=utf-8\n\n");
char* data = getenv("QUERY_STRING");
//process
}
How to return from C to the same page? How to give header("Location:".$url); in C??