I have a couple of sensors communicating with my javascript, that runs on my server on a Raspberry Pi, whenever it senses a motion.
What I want to do is to write/edit an XML file whenever the status changes so that I can read the .xml file from an android app.
After searching the web for a couple of days this seems to be a troubling thing to do for me.
My first approach was to just write to the file using javascript, but this is apparently almost impossible.
My second approach was to use PHP inside my javascript, which also seems like a hard thing to accomplish.
I am pretty new to both javascript and PHP. Could anyone help me out with this problem, or at least point me in the right direction?
Code:
if (data == "3:SSR:0")
{
$('#ROM1 .btn-text').text('ROM1 (Ledig)').parent().css("background", "green");
lights["ROM1"] = "Ledig";
}
I want to write to the file whenever if (data == "3:SSR:0") is true.