Fórum | MyPower.CZ | Obnovitelné zdroje energie - energetická soběstačnost | Poslední návštěva: čtv bře 23, 2023 1:32 am
function getValues ( the_values )
{
var request = null;
var xml_response = null;
if (window.XMLHttpRequest)
{
request = new XMLHttpRequest ();
}
else
{
request = new ActiveXObject ("Microsoft.XMLHTTP");
}
var the_URL = "http://192.168.0.8/ajax_inputs";
if ( request )
{
request.open ("GET", the_URL);
request.onreadystatechange = function ()
{
if ( request.readyState == 4 )
{
displayResults (request.responseText);
}
}
request.send (null);
}
else
{
alert ("Sorry");
}
}
rottenkiwi píše:V PHP súbore, ktorý je na localhost kde je Debian a Apache chcem pomocou nasledujúcej ......
rottenkiwi píše:Viete mi poradiť akú hlavičku mám poslať, aby mi to povolilo komunikáciu ?
client.println("HTTP/1.1 200 OK");
client.println("Access-Control-Allow-Origin: http://rottenkiwi.no-ip.biz");
// remainder of header follows below, depending on if
// web page or XML page is requested
// Ajax request - send XML file
if (StrContains(HTTP_req, "GET")
&& StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
//SetLEDs ();
// send XML file containing input states
XML_response(client);
}
else
if (StrContains(HTTP_req, "POST")
&& StrContains(HTTP_req, "ajax_inputs=1")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
//SetLEDs ();
// send XML file containing input states
XML_response(client);
}
Uživatelé procházející toto fórum: CC [Bot] a 0 návštevníků