JSON cross site without JSONP

后端 未结 5 931
半阙折子戏
半阙折子戏 2021-01-22 15:15

I have a local piece of hardware that I access via it\'s IP address to retrieve json data.

I am creating a web based app but it can not access the local json data when t

5条回答
  •  太阳男子
    2021-01-22 15:53

    If your url looks something like this http:///RequestedJson then you might use flXHR which is quite convenient.

    1) Import the libraries of flXHR
    2) Simply create an instance of flXHR
    3) Then assign it to jQuery Ajax options

    $.ajaxSetup({
       "xhr": myflXHRInstance
    });
    

    (more info in ajaxOptions page)
    4) Put crossdomain.xml in the root of your ip i.e. http:///crossdomain.xml More info about crossdomain.xml

    5) Enjoy your crossdomain requests via jQuery ))

    P.S. Requires the flash plugin to be installed. There are almost no browsers that do not have Flash player plugin installed. Riastats

    EDIT: Sorry for russian link for crossdomain.xml.
    Crossdomain.xml example

提交回复
热议问题