从jQuery的阿贾克斯以breeze.js(的SharePoint ODATA例子) [英] from jQuery-ajax to breeze.js (SharePoint ODATA example)

查看:204
本文介绍了从jQuery的阿贾克斯以breeze.js(的SharePoint ODATA例子)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用breeze.js我ODATA服务。

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

我使用的SharePoint ODATA API和我有一个如何使用它与jQuery Ajax的一个例子。为了使这项工作有微风会如此F-荷兰国际集团真棒。谁能帮我为翻译这个jQuery,Ajax调用到breeze.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
});

在这里你可以看到一个ODATA调用到SharePoint WebProxy。一个整洁的功能来处理你的跨域调用!

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

我觉得在这一点上的问题是:我可以构造数据对象breeze.js

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

推荐答案

_ / API是一个OData的v3的端点。 AFAIK没有微风,也不JayData支持,充分的时刻。更糟糕的是_api / $元数据是不是在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的阿贾克斯以breeze.js(的SharePoint ODATA例子)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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