简体   繁体   English

三星智能电视中的JQuery.Ajax不显示

[英]JQuery.Ajax in Samsung Smart TV not displaying

I used JQuery.Ajax to try to communicate with my webservice 我使用JQuery.Ajax尝试与我的Web服务进行通信

Here is how the code looks like: 代码如下所示:

Main.onLoad = function() {
    // Enable key event processing
    this.enableKeys();
    widgetAPI.sendReadyEvent();
    //$("#h2Test").html("Change On Text");

        $.ajax({
                    url : 'http://---.--.---.--:-----/_layouts/-----/------.asmx?op=retrieveEvents',
                    type : "POST",
                    dataType : 'json',
                    contentType : 'application/json',
                    data : {
                        url : "someURL"
                    },
                    success : function(response) {
                        $("#h2Test").html("SUCCESS");
                    },
                    failure : function(response) {
                        $("#h2Test").html("FAIL");
                    }
        });
};

When i run the codes, Change On Text is displayed instead of SUCCESS or FAIL, why doesn't the code reaches either success or error 当我运行代码时,显示“按文本更改”,而不是“成功”或“失败”,为什么代码未达到成功或错误

According to http://api.jquery.com/jQuery.ajax/ you should replace your 根据http://api.jquery.com/jQuery.ajax/,您应该替换您的

failure: function(response) {

with

error: function(response) {

It probably should reach the error function then. 然后它可能应该到达错误功能。

In mobile and tv apps you should take care about "same domain policy" by using: dataType: "jsonp" and jsonpCallback (also declaring the latter). 在移动和电视应用程序中,您应该使用以下数据项来注意“相同的域策略”:dataType:“ jsonp”和jsonpCallback(还声明后者)。 Take a look: 看一看:

http://api.jquery.com/jQuery.ajax/ http://api.jquery.com/jQuery.ajax/

and

Callback function for JSONP with JQuery ajax 带有JQuery ajax的JSONP的回调函数

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

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