Hi guys, a question.
How ever when I create a "http server application" program with these simple 3 rows in the OnRequest event
AResponse.ContentType := 'text/html;charset=utf-8';
AResponse.Content:='hello world';
Handled := True;
If I launch a url in a browser I see the word 'hello world' correctly, but if I run an ajax call from an html file I can not see the result.
In my opinion I mistake something in the parameterization of the lazarus program. Does anyone know why?
My javascript code:
<html>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
function Read()
{
$.ajax({
url: "http://127.0.0.1:8080/gettext.html",
contentType: "application/x-www-form-urlencoded;charset=utf-8",
success: function (response)
{
alert(response);
},
error: function(XMLHttpRequest, textStatus, exception) { alert("Ajax failure\n" + errortext); },
async: true
});
}
</script>
<body>
<button onclick="Read()">-Premi-</button>
</body>
</html>