Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

前端 未结 11 1512
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 16:55

I\'m writing a simple site that takes as input an idiom, and return its meaning(s) and example(s) from Oxford Dictionary. Here\'s my idea:

I send a request to the fol

11条回答
  •  时光取名叫无心
    2020-12-02 17:44

    I used the header("Access-Control-Allow-Origin: *"); method but still received the CORS error. It turns out that the PHP script that was being requested had an error in it (I had forgotten to add a period (.) when concatenating two variables). Once I fixed that typo, it worked!

    So, It seems that the remote script being called cannot have errors within it.

提交回复
热议问题