1

How can I call a CGI function within a javascript function? Such like this:

function jsFun()  
{  
    //something that can call a CGI function  
}  
Martin G
  • 17,357
  • 9
  • 82
  • 98
Fan Wu
  • 169
  • 2
  • 11

1 Answers1

2

Try jQuery.

function jsFun() {
    $.post(YOUR_CGI_URL, YOUR_PARAMS);
}
marc
  • 6,103
  • 1
  • 28
  • 33
  • Thanks a lot. In this method, how can my cgi function(C function) obtain the params transfered by the js? – Fan Wu Jul 26 '11 at 09:09
  • Your C code can read from `stdin`. See [this tutorial](http://www.cs.tut.fi/~jkorpela/forms/cgic.html#post) for guidelines how to do it. – marc Jul 26 '11 at 09:12