简体   繁体   中英

Widget cross domain ajax call

We have a widget for clients to put onto their website. This widget needs to make a call to our website to validate some data entered by the user. However, ajax calls are domain bound, so calling from the clients webpage to our webpage is not allowed.

How can i make a request from any site to my own?

There is a way, i'm sure. For example, Facebook, with it's user hosted like button, probably also makes a request to their own website.

EDIT

i am using XMLHTTP for this

Without enabling any options on the client website.

Try setting your data type to 'jsonp', as seen in this answer . Although that answer is in jQuery, it is still possible , although slightly more difficult. I don't want to be one of "those guys", but in this case it's easier to use jQuery.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM