Sending JSONP vs. JSON data?
问题 I am making a web service that needs to return data in JSONP format. I am using the JSON taglib for JSP, and I thought all that had to be added were parenthesis, but I cannot find a good resource which verifies this. For example, ever web service function returns using this function: private static String getJSONPObject(String s) throws JSONException { return "(" + new JSONObject(s) + ")"; } Is this correct? Thanks! 回答1: JSONP is simply a hack to allow web apps to retrieve data across domains