【问题标题】:How to run SOQL query via jquery ajax?如何通过 jquery ajax 运行 SOQL 查询?
【发布时间】:2015-06-29 22:19:43
【问题描述】:

我一直按照此处的指南通过 ajax 进行 apex rest 调用,但我得到的只是状态 0 错误。 http://www.oyecode.com/2014/02/how-to-salesforce-rest-api-from-browser.html

是否有其他关于如何通过 ajax 进行 SOQL 查询的指南/教程?我做错了什么?

这是我目前拥有的。它不应该有所作为,但我正在使用谷歌应用程序脚本从 htmlservice 进行此调用。

$.ajax(
{
  type: "GET",
  url: "https://na15.salesforce.com/services/data/v26.0/query/?q=SELECT+Name+FROM+Account+LIMIT+5",
  beforeSend: function (xhr) 
  {
    xhr.setRequestHeader('Authorization', "Bearer eeeee.xxxxxx");
    xhr.setRequestHeader('Accept', "application/json");
    xhr.setRequestHeader('dataType', "jsonp");
    //usually not needed but when you are
    xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
    xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET');
  },
  success: function (data) 
  {
    alert(data);
  },
  error: function(one, two, three)
  {
    alert(one.status);
    alert(two);
    alert(three);
  }
});

【问题讨论】:

    标签: jquery ajax rest google-apps-script soql


    【解决方案1】:

    这并不能回答您的问题,但我使用以下连接器已有几年了,它的工作就像一个魅力: https://github.com/gidzone/cloudconnector

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-08
      • 1970-01-01
      • 1970-01-01
      • 2021-11-12
      • 2010-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多