문제

I'm going to develop a samsung smart tv app, but I don't know how to make request in server db because samsung smart tv supports only Javascript.

도움이 되었습니까?

해결책

You can't access the database directly. You need to create a web service. Your server will accept HTTP requests, run a piece of software (e.g. written in Perl or PHP) and return the data in the response.

Samsung provides an implementation of XMLHttpRequest. You can use this to cause the device to make the HTTP requests.

They have an example of how to use it in their SDK documentation.

다른 팁

With javascript only you will not be able to do that.

You will need:

  1. php (or any other server sided) page on your server which connects to the database and delievers an output in any form, best way would be in JSON Object Notation.
  2. within your Javascript you are able to do AJAX calls, which load's the output of your php page and brings the data to your Javascript. As you tagged you are using jQuery, so I linked directly to the jQuery ajax documentation.
$.ajax({
  url: 'samsungdata.php',
  success: function(data) {

    alert('Load was performed.');
  }
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top