jQuery.getJSONとjQuery.postJSON
JQueryの$.getJSONを使用するに辺り、GETの限界価を調査。
結果は7桁のカンマ区切り番号データ700-800程度渡すのが限界ということが実測で判明。
GETで渡せる限界はこのあたりに書いてあるので、詳細は割愛。
http://d.hatena.ne.jp/Kazumi007/20090921/1253501500
jQuery.postJSONは元々JQueryには用意されていないので、
他の人のブログなどを参考に「jQuery.postJSON」を作って対応しました。
http://blog.suz-lab.com/2008/10/jquerypostjson.html
PHPではPOSTできるデータサイズがデフォルトで「post_max_size=16M」になっているようなので、
そちらも必要に応じて修正するべし。
結果的にこんな感じ↓
<script language="javascript" type="text/javascript"> function use_get_json(){ $(document).ready(function() { $.getJSON("http://localhost/json.php", {target_list:'1,2,3'}, function(data, status){ alert(data); }); }); } //こいつを書くとpopstJSONできる♪ jQuery.postJSON = function(url, data, callback) { jQuery.post(url, data, callback, "json"); }; function use_post_json(){ $(document).ready(function() { $.postJSON("http://localhost/json.php",{target_list:'1,2,3'}, function(data) { alert(data); }); }); } </script> <input type='button' value='送信' onclick='use_get_json();' /> <input type='button' value='送信' onclick='use_post_json();' />