Reputation: 436
I am running Mopidy on a Raspberry Pi with the latest Raspbian Wheezy.
I am trying to call a server side Perl script from Javascript like this:
var addToPlaylist = function() {
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open("POST", "addToPlaylist.pl?uri=" + encodeURI("testuri") + "&&name=" + encodeURI("testname"), true);
xmlHttpRequest.send();
}
But I get the error:
POST http://192.168.0.10:6680/addToPlaylist.pl?uri=testuri&&name=testname 404 (Not Found)
However, if I navigate my browser to:
http://192.168.0.10:6680/addToPlaylist.pl
I can see the script in plain text.
I have tried moving the file to where Mopidy gets it's Javascript files from and to various other places, and the file has a full set of permissions.
Is this likely to be something Mopidy specific or is this a general web server thing? Obviously I don't want to be able to access the R-Pi's whole file system, so is there somewhere where I need to whitelist what can be seen from the client? I am new to Javascript and Web Servers so I do not know the terminology to search for. Could you point me in the right direction?
Thanks
Upvotes: 0
Views: 130
Reputation: 33063
You need to run something that can run Perl scripts, e.g. Perl Dancer, on another port.
Upvotes: 1