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

JQuery.Ajax in Samsung Smart TV not displaying

本文关键字:电视 显示 智能 三星 Ajax JQuery      更新时间:2023-09-26

我使用JQuery.Ajax尝试与我的Web服务进行通信

代码如下所示:

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");
                    }
        });
};
当我运行代码时,显示文本更改而不是成功或

失败,为什么代码没有达到成功或错误

根据 http://api.jquery.com/jQuery.ajax/你应该替换你的

failure: function(response) {

error: function(response) {

然后它可能应该达到错误函数。

在移动和电视应用程序中,您应该通过使用:dataType:"jsonp"和jsonpCallback(也声明后者)来关注"相同的域策略"。看一看:

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

JSONP with JQuery ajax 的回调函数