Origin 'url' is not allowed by Access-Control-Allow-Origin

前端 未结 4 1530
忘掉有多难
忘掉有多难 2020-12-29 09:39

I\'m trying to get a currency rate with the Google Currency Calculator using the following jquery (dummy) code:

    $.getJSON(\"http://www.googl         


        
4条回答
  •  Happy的楠姐
    2020-12-29 10:27

    Minor additional point of info.

    I got to this question because I got this error trying to post to my own server.

    Solution: make sure hostname matches in ajax call.

    Exmaple:

    //This failed
    
    $.post("http://domain.com/index.php/count/",
    
    //This succeeded (the page this was called from was www.domain.com/.....)
    
    $.post("http://www.domain.com/index.php/count/",
    

提交回复
热议问题