This is properly been asked before, but I'm not entirely sure what to search on.
But I'm trying to make my own web app or maybe mobile app, to control my indigo server. But using the REST url api.
But I'm not sure how get through the password protection. and getting access. Is there some one how tried this before, and can give me some hints.
I have tried this, but i didn't work. A simple html file on another server on the network.
- Code: Select all
<script type="text/javascript">
function load(Test) {
var username = "username";
var password = "password";
$.ajax({
type: 'GET',
// TO DO
url: 'http://SERVERIP:8176/devices',
dataType: 'jsonp',
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
},
success: function(data) {
alert("sork");
}
});
}
</script>
<a class="editLink" onclick="load('Test');">test af link</a>
Hopes some one i willing to help