You need to choose an approach for loading the data

You develop an HTML application that is located at www.adventure-works.com.
The application must load JSON data from www.fabrikam.com.
You need to choose an approach for loading the data.
What should you do?

You develop an HTML application that is located at www.adventure-works.com.
The application must load JSON data from www.fabrikam.com.
You need to choose an approach for loading the data.
What should you do?

A.
Design a REST URI scheme with multiple domains.

B.
Configure Cross-Origin Resource Sharing (CORS) on the servers.

C.
Load the data by using WebSockets.

D.
Use the jQuery getJSON method.

Explanation:

* You must use Cross Origin Resource Sharing
It’s not as complicated as it sounds…simply set your request headers appropriately…in Python it
would look like:
self.response.headers.add_header(‘Access-Control-Allow-Origin’, ‘*’);
self.response.headers.add_header(‘Access-Control-Allow-Methods’, ‘GET, POST, OPTIONS’);
self.response.headers.add_header(‘Access-Control-Allow-Headers’, ‘X-Requested-With’);
self.response.headers.add_header(‘Access-Control-Max-Age’, ‘86400’);
* Cross-origin resource sharing (CORS) is a mechanism that allows Javascript on a web page to make
XMLHttpRequests to another domain, not the domain the Javascript originated from.[1] Such “crossdomain” requests would otherwise be forbidden by web browsers, per the same origin security
policy. CORS defines a way in which the browser and the server can interact to determine whether
or not to allow the cross-origin request.[2] It is more powerful than only allowing same-origin
requests, but it is more secure than simply allowing all such cross-origin requests.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Question

Question

“in Python it
would look like:”

Is this a fucking joke or what!?

Question

Question

Its not lol.

Sakir

Sakir

Answer is B “Configure Cross-Origin Resource Sharing (CORS) on the servers”