Dim Dim - 8 months ago 38
Ajax Question

Sharepoint How to do get request to external web service

How can I make get request from Sharepoint object model to external web service? I tried did it with ajax request:

$.get("http:/servername/webservice_name", function(data, status) {
alert("Data: " + data[0] + "\nStatus: " + status);


But I have an error: Access denied.
My web service has response in JSON format.
I have read a lot of article, but there are no decisions. I read, that ajax forbidden in SharePoint for external web service. How can I make it without ajax?

Dim Dim

In the SharePoint online it is work only for https web services. http from https web sites not allowed. Final code, which work with https:

    url: "https://services.odata.org/Northwind/Northwind.svc/Customers",
    type: "GET",
    headers: { "ACCEPT": "application/json;odata=verbose" },
    async: false,
    success: function (data) {
            alert("Results Count:"+data.d.results.length);
            alert("no data");
    error: function () {
        //alert("Failed to get details");