简体   繁体   English

在服务器,三星智能电视应用中发出请求?

[英]Making request in server, Samsung smart tv app?

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

With javascript only you will not be able to do that. 仅使用javascript,您将无法做到这一点。

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. 服务器上的php(或任何其他服务器端)页面连接到数据库并以任何形式导出输出,最好的方式是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. 在Javascript中,您可以进行AJAX调用,这将加载php页面的输出并将数据带到Javascript中。 As you tagged you are using jQuery, so I linked directly to the jQuery ajax documentation. 当您标记您正在使用jQuery时,因此我直接链接到jQuery ajax文档。
 $.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. 您需要创建一个Web服务。 Your server will accept HTTP requests, run a piece of software (eg written in Perl or PHP) and return the data in the response. 您的服务器将接受HTTP请求,运行一个软件(例如,用Perl或PHP编写),然后在响应中返回数据。

Samsung provides an implementation of XMLHttpRequest. 三星提供了XMLHttpRequest的实现。 You can use this to cause the device to make the HTTP requests. 您可以使用它来使设备发出HTTP请求。

They have an example of how to use it in their SDK documentation . 他们在SDK文档中提供了有关如何使用它示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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