Wednesday, October 2, 2019

javascript - jQuery Ajax error: 'null' has been blocked by CORS policy

I have to make a game, which gives the definition of a word and you have to guess it. It gives me an error while making an Ajax request:



jquery-3.2.1.js:9566 Access to XMLHttpRequest at 'file:///D:/Grado%20Superior/2do/DWEC/logogrifo_CristinaBorrego/logogrifo.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

send @ jquery-3.2.1.js:9566
ajax @ jquery-3.2.1.js:9173
jQuery.(anonymous function) @ jquery-3.2.1.js:9322
getJSON @ jquery-3.2.1.js:9303
(anonymous) @ index.html:44
jquery-3.2.1.js:3860 jQuery.Deferred exception: Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined
at HTMLDocument. (file:///D:/Grado%20Superior/2do/DWEC/logogrifo_CristinaBorrego/index.html:55:62)
at mightThrow (https://code.jquery.com/jquery-3.2.1.js:3583:29)
at process (https://code.jquery.com/jquery-3.2.1.js:3651:12) undefined
jQuery.Deferred.exceptionHook @ jquery-3.2.1.js:3860

process @ jquery-3.2.1.js:3655
setTimeout (async)
(anonymous) @ jquery-3.2.1.js:3689
fire @ jquery-3.2.1.js:3317
fireWith @ jquery-3.2.1.js:3447
fire @ jquery-3.2.1.js:3455
fire @ jquery-3.2.1.js:3317
fireWith @ jquery-3.2.1.js:3447
ready @ jquery-3.2.1.js:3920
completed @ jquery-3.2.1.js:3930

jquery-3.2.1.js:3869 Uncaught TypeError: Cannot read property 'length' of undefined
at HTMLDocument. (index.html:55)
at mightThrow (jquery-3.2.1.js:3583)
at process (jquery-3.2.1.js:3651)


My code:












Logogrifo




Logogrifo












src="https://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous">





No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...