Javascript-ajax cross-domain request issues

Source: Internet
Author: User
PHP side has header ("access-control-allow-origin:*");

Ajax requests

    $.ajax(    {        type : "post",        url : url,        async : false,        dataType: 'json',        data : {asdsa:1},        success : function (obj)        {                //业务代码        },        error : function (obj) {            alert('未找到文件');        }    }    );

Data emptying such as {} On Error cors header missing ' access-control-allow-origin '

Data write a random parameter such as {dasdsa:1} is normal, what is the matter?
Cross-domain access does not occur when there is no domain name binding on the test machine, and now it is not possible to bind the domain name online

PS. Test and on-line there is a different, testing the back end of the Apache, on-line backend with Nginx, and this has a relationship?

Reply content:

PHP side has header ("access-control-allow-origin:*");

Ajax requests

    $.ajax(    {        type : "post",        url : url,        async : false,        dataType: 'json',        data : {asdsa:1},        success : function (obj)        {                //业务代码        },        error : function (obj) {            alert('未找到文件');        }    }    );

Data emptying such as {} On Error cors header missing ' access-control-allow-origin '

Data write a random parameter such as {dasdsa:1} is normal, what is the matter?
Cross-domain access does not occur when there is no domain name binding on the test machine, and now it is not possible to bind the domain name online

PS. Test and on-line there is a different, testing the back end of the Apache, on-line backend with Nginx, and this has a relationship?

Don't know what you're talking about across domains, Ajax can only be active within the root directory.

It feels like an Ajax cache problem, and the other cross-domain should be jsonp.

Is there a server-side error or a client error in the network?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.