I have made a cgi program in C, which generates HTML, and I would like to replace a part of a HTML page with it. So, using jquery I have tried to get the output of my cgi using $.ajax(),$.get() or $.post() but it doesn't work and I found nothing relevant in firefox and chromium's debugger. I run Apache localy, and the logs say it did have a request
127.0.0.1 - - [20/May/2013:01:19:32 +0200] "GET /cgi-bin/test_cgi HTTP/1.1" 200 682
I have looked for hours, and it seems like people are using the code just like I do but it works for them, not for me, so I'll just paste it and let you take a look to what is wrong
javascript(jquery):
$(document).ready(function() {
$('#button_ajax').click(function() {
alert("success1");
$.get('http://localhost/cgi-bin/test_cgi', function(data) {
//$('#ajax').empty().append(data);
alert("success2");
});
});
});
html:
<button id="button_ajax">Click here!</button>
<div id="ajax">
<p>Some random test</p>
</div>
There is a pop-up for "success1", but then nothing for "success2" And here is what I get in firefox debugger
> [01:19:32,898] GET http://localhost/cgi-bin/test_cgi [HTTP/1.1 200 OK
> 2ms]
with chromium debugger I get this
XMLHttpRequest cannot load http://localhost/cgi-bin/test_cgi. Origin null is not allowed by Access-Control-Allow-Origin.
Anyone up for some recommandations?