�Ȥ����櫓�ǡ��������Ƥߤޤ�����
snippets from shinichitomita��s journal - �ؿ�̾����Υ�����Хå���JSONP�ȸ������ȤˤĤ���������С����ץ������ǹ�®��padding��ʬ��ñ¤´ï¿½ï¿½ï¿½ï¿½ë¥ï¿½ï¿½Ã¥ï¿½ï¿½å¤¬ï¿½ï¿½ï¿½Ã¤Æ¤â¤¤ï¿½ï¿½ï¿½ï¿½Ê¡ï¿½ï¿½È»×¤Ã¤ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½mod��뤫��
�Ȥ����Ϥ�������ñ��
http://server.whereever/path/to/jsonp2jsonp.cgi/callback_name/http://server.elsewhere/path/to/original/jsonp
��URI�˥���������������ǡ�http://server.elsewhere/path/to/original/jsonp�ν��Ϸ�̤�callback��̾����callback_name���Ѵ�����ޤ���
- URL:
- Callback Code:
- Output:
Client Source:
<script language="JavaScript" src="http://www.kawa.net/works/js/jkl/share/jkl-dumper.js"></script> <script> function JSONP2JSONP(proxy, cb){ this.proxy = proxy; this.cb = (cb || 'jsonp'); this.parse = function(uri, cb){ if (! cb) cb = this.cb; var script = document.createElement('script'); script.id = this.proxy + '/' + cb + '/' + uri; script.charset = 'UTF-8'; script.src = script.id; document.lastChild.appendChild(script); }; return this; } function $(id){ return document.getElementById(id) } var jsonp2jsonp = new JSONP2JSONP('http://www.dan.co.jp/~dankogai/cgi/jsonp2jsonp.cgi'); function eval_code(){ try{ eval($('code').value); }catch(e){ alert(e); return; } $('code').value.match(/^([_0-9A-Za-z]+) /); var fname = RegExp.$1; // alert(fname); jsonp2jsonp.parse($('uri').value, fname); } </script> <div style="border: dotted 1px; padding: 0.25em"> <dl> <dt>URL:</dt> <dd><input type="text" id="uri" size="64" value="http://www.dan.co.jp/~dankogai/yubin2jsonp/100/1000001.js"><dd> <dt>Callback Code:</dt> <dd><textarea id="code" cols="64" rows="4"> whatever_the_function_name_is = function(json){ alert(json) // $('json').innerHTML = (new JKL.Dumper()).dump(json) }; </textarea> <dt>Output:</dt> <dd><pre id="json"></pre></dd> </dd> </dl> <input type="submit" onclick="eval_code()" > <input type="submit" onclick="json.innerHTML=''" value="clear output"> </div>
Enjoy!
Dan the Javascripting Perl Monger
���Υ֥����˥����Ȥ���ˤ�����������ɬ�פǤ���
��������������
���ε����ˤϵ��ĥ桼�����������Ȥ��Ǥ��ޤ���