How do I know if a server has JSONP turned on?

后端 未结 3 1776
春和景丽
春和景丽 2020-12-06 02:21

How do I know if a server has JSONP turned on? It is not my server, but I try to access some information from the rendered html.

Thanks in advance.

3条回答
  •  萌比男神i
    2020-12-06 02:39

    The server has JSONP turned on if you can add callback to the URL:

    http://example.com/api/get_info.js?callback=myfunc
    

    and the server responds with your requested information in JSON-format, wrapped with your callback:

    myfunc({
        /* json formatted data goes here */
    });
    

提交回复
热议问题