简体   繁体   中英

Making request in server, Samsung smart tv app?

我将开发一个三星智能电视应用程序,但是我不知道如何在服务器数据库中发出请求,因为三星智能电视仅支持Javascript。

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.'); } }); 

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 (eg 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM