Can send Ajax request from a Shiny Application, hosted in Shiny server?
Related
I am new to Office.js API. I am trying to develop Web Add-In for Excel and I need to get data from WebAPI for this I am trying to use ajax but its not working
Here is very simple Ajax code
$.ajax({
url: "http://localhost:61721/api/values",
type: "GET",
dataType:"JSONP",
success: function (data) {
$("#div1").html(JSON.stringify(data));
},
error:function(error){}
});
Update
Is there any alternative way other than Ajax in Office.js through which we can get data from Web API?
From the client, AJAX requests must be send to SSL URIs and those URIs must be declared in AppDomain list of the app manifest. Please refer to: Send POST AJAX request from Office Add-In.
In the same time, if your app has server side portion of code, you may send direct request to any Web API from there. Nobody limit you in technology (REST, microservices, etc.) and nobody check your connection is secure, when using 3rd party resources from your server.
If I hit any AJAX request on targeting server then the request directly goes to targeting server or the request first goes to origin server and then goes to targeting server?
Cross-origin AJAX requests go directly from your browser to what you call the “targeting server”.
A cross-origin AJAX request is initiated by JavaScript running in your browser on the client side after the browser fetches the JavaScript for your Web application/document from the origin server.
A cross-origin AJAX request does not go back to the origin server ever. The communication is: JavaScript running in your browser sends a request to the “targeting” server, which replies with a response directly back to the browser and back to your JavaScript running on the client side.
My website uses Ajax to report the user's progress back to the server while the user stays on the same webpage. This works fine on all browsers except the Facebook In-App Browser (FB IAB). Why?
If your web server uses cookies when processing Ajax requests, you will have the following problem:
After a web page loads, FB IAB doesn't send cookies to the server for Ajax calls. I consider this a bug.
A workaround is to send all required data in the querystring instead.
While I am testing a web application, for some requests that are computational intensive on the server side, I would like to simulate the server response directly from a browser add-on. I would like to be able to configure the URL and set-up a JSON response that will be returned by the browser without sending the request to the server.
Does any of you know a good tool for this purpose ?
P.S. So far I am either changing the server code to simulate the response or changing the client code to return the response without triggering the request to server.
I plan to use https to build a website. After the user logs in, s/he is directed to a dashboard. The dashboard will be developed using javascript and html5. What are the thing I need to keep in mind when I make ajax calls using SOAP to a web service while using https?
The most important things:
always use the same domain name, otherwise browser will throw cross domain errors,
always use https protocol for every ajax request, so browser won't get same origin errors.
On the server side check for X-Requested-With: XMLHttpRequest HTTP header, to be sure that the request came as AJAX, not standalone GET/POST request. This is only difference.
With AJAX request browser will send the same cookies value as in the any other request, so you can surely check user session with it.