このプロシージャは、JSON出力の標準HTTPヘッダーを出力します。
構文
APEX_PLUGIN_UTIL.PRINT_JSON_HTTP_HEADER;
パラメータ
なし
例
次の例に、プラグインのAjaxコールバック・ファンクションでこのプロシージャを使用する方法を示します。このコードは、JSONの構造を[{"d":"Display 1","r":"Return 1"},{"d":"Display 2","r":"Return 2"}]
という形式で出力します。
-- Write header for the JSON stream. apex_plugin_util.print_json_http_header; -- initialize the JSON structure sys.htp.p('['); -- loop through the value array for i in 1 .. l_values.count loop -- add array entry sys.htp.p ( case when i > 1 then ',' end|| '{'|| apex_javascript.add_attribute('d', sys.htf.escape_sc(l_values(i).display_value), false, true)|| apex_javascript.add_attribute('r', sys.htf.escape_sc(l_values(i).return_value), false, false)|| '}' ); end loop; -- close the JSON structure sys.htp.p(']');
親トピック: APEX_PLUGIN_UTIL