Title, ask for help!
Chrome with parameters start--disable-web-security--allow-file-access-from-files
It should be possible to load local files, search through Google and English websites, or not solve the problem.
The chrome console does not error, but the request status is canceled.
Ajax is also the same with the jquery library.
<!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/> <title>Test</title></Head><Body> <Script>Ajax ("File:///C:/IDCardReader/wz.json", function(a) {alert (a); }, function(a) {alert ("Error"+a); }) functionAjax (URL, fnsucc, fnfaild) {//1. Creating an Ajax Object varOajax= NULL; if(window. XMLHttpRequest)//two ways to get Ajax objects{Oajax= NewXMLHttpRequest (); } Else{Oajax= NewActiveXObject ("Microsoft.XMLHTTP"); } //2. Connect to the serverOajax.open ('GET', URLs,true); //3. Sending the requestOajax.send (); //4. Return of the receiving serverOajax.onreadystatechange= function () { if(Oajax.readystate== 4) //Complete { if(Oajax.status== $) //Success{FNSUCC (oajax.responsetext); } Else { if(Fnfaild) fnfaild (oajax.status); } } }; } </Script></Body></HTML>
Ask for advice, Thanksgiving!
Headache: Why chrome cannot access local files (with--disable-web-security--allow-file-access-from-files)