从 jQuery-ajax 到微风.js(SharePoint ODATA 示例) [英] from jQuery-ajax to breeze.js (SharePoint ODATA example)

查看:18
本文介绍了从 jQuery-ajax 到微风.js(SharePoint ODATA 示例)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始将微风.js 用于我的 ODATA 服务.

I am starting to use breeze.js for my ODATA service.

我正在使用 SharePoint ODATA api,我有一个如何将它与 jQuery-Ajax 一起使用的示例.用微风完成这项工作真是太棒了.谁能帮我将这个 jQuery-Ajax 调用翻译成微风.js?……还是将我推向正确的方向?

I am using a SharePoint ODATA api and i have an example of how to use it with jQuery-Ajax. To make this work with breeze would be so f-ing awesome. Can anyone help me to translate this jQuery-Ajax call into breeze.js ? ... or push me in the right direction?

$.ajax({
  url: "../_api/SP.WebProxy.invoke",
  type: "POST",
  data: JSON.stringify({
    "requestInfo": {
      "__metadata": { 
        "type": "SP.WebRequestInfo" },
        "Url": "http://get_my_data_from_this_url",
        "Method": "GET",
        "Headers": {
          "results": [{
            "__metadata": { "type": "SP.KeyValue" },
            "Key": "Accept",
            "Value": "application/json;odata=verbose",
            "ValueType": "Edm.String"
          }]
        }
     }
  }),
  headers: {
    "Accept": "application/json;odata=verbose",
    "Content-Type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
  },
  success: successHandler,
  error: errorHandler
});

您可以在此处看到对 SharePoint WebProxy 的 ODATA 调用.一个处理跨域呼叫的简洁功能!

Here you can see an ODATA call to the SharePoint WebProxy. A neat feature to handle your cross domain calls!

我认为此时的问题是:我可以使用微风.js 构建数据对象吗?

I think the question at this point is: can i construct the data object with breeze.js?

推荐答案

_/api 是一个 OData v3 端点.AFAIK 目前 Breeze 和 JayData 都不完全支持.更糟糕的是 _api/$metadata 在 SP2013 的发布版本中没有实现.没有元数据文档,就无法自动创建所需的数据模型.

_/api is an OData v3 endpoint. AFAIK neither Breeze nor JayData support that fully at the moment. To make things worse _api/$metadata is not implemented in the release version of SP2013. Without the metadata document there's no way to automatically create the required data model.

这篇关于从 jQuery-ajax 到微风.js(SharePoint ODATA 示例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆