كيفية الحصول على بيانات JSON من خدمة عن بعد في تطبيق SharePoint 2013؟
-
10-12-2019 - |
سؤال
أنا أعمل على تطبيق ل SharePoint 2013 الذي يستضيف SharePoint-استضافة ولا يمكنني الحصول على بيانات من خدمة ويب عن بعد باستخدام مكالمة JQuery.ajax.الاتجاهين الوحيدتين للحصول على البيانات البعيدة الموثقة من قبل Microsoft هي: باستخدام دعوة وكيل الويب أو صفحة وكيل مخصص .
هل هذه الطرق الوحيدة التي يمكنك استخدامها أو هل هناك شيء آخر متاح؟أنا أبحث عن شيء مشابه مع دعوة jquery.ajax.
المحلول
Here is a method to accomplish this: from the JavaScript page code use the jQuery.ajax function with the argument "dataType" set to "jsonp" and call the web service that supports jsonp requests and that returns a json result back.
You can find more details about a .NET specific implementation of a web service and the call code here: Rick Strahl - Creating a JSONP Formatter for ASP.NET Web API. You can get data from any web service that supports jsonp calls: it can be a node.js or a rails service.