About ajax requests and cross-domain confusion

in Google browser, open the written local html, this html has a $.ajax request, and the requested url is a distant server. Before, you can initiate ajax requests, but it will not occur as shown in the following figure:
clipboard.png
I have tried-- allow-file-access-from-files, but it doesn"t work, including restarting the computer with the cmd command. Does this error mean that I am cross-domain? Then why was it all right with me before? This is what bothers me. When I tried it in the afternoon, I didn"t know what to press, and suddenly I could make a request again, but then it didn"t work until now.
and the url I requested with ajax is a remote server, so am I cross-domain? Xhr is not the client initiates the request to the server, so the local client and the server are not two domains, is the browser"s own cors to solve this problem? Then why did this happen to me

Mar.02,2021

this is an obvious cross-domain problem, which is usually solved by the backend. If you want to use the front end, the above two solutions are also available. I recommend using gulp or webpack to open the local server to manage your page, and then set the proxy service in the configuration. It is very convenient. Jsonp can only solve the request of the get method, but there is no way for post, so it is most reliable to set up a proxy service.


the key also depends on whether your remote interface has not changed all the time. Cross-domain frontend alone cannot be solved. Unless you set up a proxy server, local developers can install nginx locally


in fact, cross-domain is a security policy of the server, mainly to prevent access to the server from addresses or domains that are not allowed by the server.
solution:

    1.  *.
    2. webpack , .
    3. nginx   .
    4. $ajaxjsonp 
       
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b216-2a7b4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b216-2a7b4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?