How to handle json DateTime returned from WCF Data Services (OData)

前端 未结 8 804
情书的邮戳
情书的邮戳 2020-12-01 11:19

I believe I am missing something obvious here. When I request a JSON response from an OData service I get a different result for the DateTime properties than I do when I req

8条回答
  •  独厮守ぢ
    2020-12-01 11:37

    We produce data.js as a JavaScript client for OData services. If you're working from a Web client, using this library will remove this headache as well as prevent you from running into others.

    Data.js handles all of the JSONP and other concerns on your behalf, making requesting and parsing JSON data this easy:

    OData.read( 
      "http://services.odata.org/Northwind/Northwind.svc/Categories", 
      function (data) { 
        var html = ""; 
        $.each(data.results, function(l) { html += "
    " + l.CategoryName + "
    "; }); $(html).appendTo($("#target-element-id")); } );

提交回复
热议问题