0

在让我的 jsonp 与我的客户端主干脚本一起工作时遇到问题,pagenator 保持 gettgin 无效密钥错误环顾四周人们说这与我的服务有关,不返回 jsonp。

例如 SyntaxError: invalid label,我写了一个 mvc4 web api 服务,这是它返回的内容,它看起来是否正确,还有什么我需要添加到我的 api 以支持 jsonp 吗?

   {
      "odata.metadata":"http://test.test.uk/api/odata/$metadata#lnews","value":[
        {
          "ID":1,"title":"This is a test news artical","mainContent":"<p>\r\n\tthis is a test article</p>\r\n","featured":1,"visiblehomepage":1,"thedatetime":"2013-08-05T10:36:05.98","expireon":"2013-08-15T00:00:00","category":17,"embargo":null,"embargotime":"PT0S","embargodate":null,"customthumbnail":null,"news_layout":3,"LNBE":0,"LNBN":0,"LNBS":0,"LNBW":0,"LNWV":0,"LNWS":1,"LNDY":0,"LNSW":0,"LNSH":0,"LNCV":0
        },{
          "ID":2,"title":"This is a test article","mainContent":"<p>\r\n\twelcome to the best site in the world</p>\r\n","featured":1,"homepage":1,"thedatetime":"2013-08-05T10:42:54.763","expireon":"2013-08-22T00:00:00","category":null,"embargo":null,"embargotime":"PT0S","embargodate":null,"customthumbnail":"Water lilies.jpg","news_layout":4,"LNBE":1,"LNBN":1,"LNBS":1,"ff":1,"LNWV":1,"LNWS":1,"LNDY":1,"LNSW":1,"LNSH":1,"LNCV":1
        }
      ]
    }
4

1 回答 1

0

这是一个 JSONP 网址:

http://odata.netflix.com/v2/Catalog/Genres?$format=json&$callback=?

这是一个图表:

客户端服务器
------ ------

发出 URL 请求 查找与此 URL 参数匹配的函数 ($callback)

异步执行如果找到,异步执行函数

从回调返回 从服务器端作为函数返回数据,或错误

参考

于 2014-04-23T18:32:02.980 回答