fix cors issue url code example
Example 1: javascript cors error
$.ajax({
headers: { "Accept": "application/json"},
type: 'GET',
url: 'http://cl.ly/2wr4',
crossDomain: true,
beforeSend: function(xhr){
xhr.withCredentials = true;
},
success: function(data, textStatus, request){
console.log(data);
}
});
Example 2: what is cors
“CORS” stands for Cross-Origin Resource Sharing.
It allows you to make requests from one website to another website
in the browser, which is normally prohibited by another browser policy
called the Same-Origin Policy (SOP).