I am facing the same-origin policy problem, and by researching the subject, I found that the best way for my particular project would be to use JSONP to do cross-origin requ
Simple jQuery, PHP and JSONP example is below:
window.onload = function(){ $.ajax({ cache: false, url: "https://jsonplaceholder.typicode.com/users/2", dataType: 'jsonp', type: 'GET', success: function(data){ console.log('data', data) }, error: function(data){ console.log(data); } }); };