To avoid this issues, you should develop your page (in your local computer it's ok) using a webserver (like apache, nginx, ...), so, your url ajax calls starts with the protocol http or https, not "file". "File" is the path of your file but using SO path system, not a web server system.

In the other hand, browsers has "Same Origin Policy". This is a security feature but what are the "problems" in web development using ajax calls? Well, your ajax calls always be done to the same server, for example, if you have your web on domain "http://my-domain.com" then your ajax calls must be to the same domain "http://my-domain.com". 

To "bypass" SOP in ajax calls, you have three solutions:


Create a proxy on your "my-domain.com" that use curl (in php for example) to retrieve the data and return it to your ajax call
Use JSON-P
Allow your domain in your webserver (.htaccess for example) setting a proper configuration to CORS: http://enable-cors.org/


BTW

I am going to answer: "Please can anyone explain what is so risky to call data via Ajax from an other domain".
(Copy &amp; paste from mozilla MDN https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)


  The same-origin policy restricts how a document or script loaded from
  one origin can interact with a resource from another origin.
  Same-origin Policy is used as a means to prevent some of the
  Cross-site Request Forgery attacks.


local AJAX-call to remote site works in Safari but not in other browsers
int m = 0;

m += m++;

System.out.println(m);


prints to 0
but i thought m will be post incremented and finally be 1.
Would someone please explain.

Note: i know how post increment works (atleast i think i do :P). But what i am trying to figure out is that when i say m + = m++ lets assume it means m = m + m++ which will evaluate m++ after sending the value of m, 0 in this case, and evaluate to m = 0 + 0 then increment the value of m because of the post increment. now if post increment has occured, why is m not 1
