search

Home  >  Q&A  >  body text

javascript - Can I use jq ajax to get data from different domains?

Can I use jq ajax to obtain data from different domains? Is it okay to use ajax directly instead of jsonp?
What do I need to do with the backend?

代言代言2702 days ago1071

reply all(2)I'll reply

  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-07-05 11:06:02

    jsonp also requires some work on the backend. Basically, if it involves cross-domain, it requires some cooperation from the backend.

    http://www.cnblogs.com/2050/p...

    You can look at cross-domain related information. You can choose different solutions for complete cross-domain and cross-subdomain.

    If you only support modern browsers, you can consider cors, which will be more convenient.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-07-05 11:06:02

    You need to fill in the relevant cross-domain permission header information in the background. . . .

    reply
    0
  • Cancelreply