Sam Fourman Jr. wrote:
I am Searching the Internet for a Basic Hello World Ajax sample written in C
if anyone has one laying around please reply to this post

Wanted simple/minimal hello world AJAX app using C ?
here it is...

/*
 *  C part
 */
#include <stdio.h>
int main(void)
{
        printf("Content-type: text/html\n\n");
        printf("Hello world");
        return 0;
}


/*
 *  HTML/JS part
 */
<html>
<script type="text/javascript">
var say_hello = function() {
        req = new XMLHttpRequest();
        req.open("GET", '/cgi-bin/hello', true);
        req.onreadystatechange = function() {
                if (req.readyState == 4) {
                        if (req.status == 200)
                                alert(req.responseText)
                }
        }
        req.send(null)
}
</script>
<input type="button" value="Ask for hello..." onClick="say_hello()">
</html>

Reply via email to