Author: lawgon Posted: April 23, 2008 Language: JavaScript Version: Not specified Score: 0 (after 0 ratings) Download Raw Displays an input with an add button. Clicking the add button creates a simple form - input with a submit button. Clicking the submit button will send the output to the server and return a value which is displayed. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
jQueryとCakePHPの異種格闘技戦。jQueryが勝っとる。これからはjQueryか。prototypeはそれ自体が汎用的な単語のため、フェアな勝負にならない。 そういうわけでjQueryのajaxを使ってみて(とりあえず挫折)したのでメモ。(いや、ajaxを使うというだけなら簡単。使い方が悪いだけ。) $.ajax()を使えばいい。 $.ajax({ url: 'hogehoge.htm', type: 'POST', dataType: 'json', // xml、 html、script、json data: params, timeout: 1000, error: function(){ // エラー時 alert('Error'); }, success: function(htm){ // コールバック } }); 上記コードで’hogehoge.htm’にpost
少しずつ時間をとって最近作ってたのがこれ。Pythonでpipeを使って実行したdfコマンドの結果を整形し、Djangoでviewを作ってAjaxで表示したもの。Ajaxのライブラリには、SimpleJSを使ってみた。 ファイルの命名は適当ですがお気になさらず。サイズを取得してるディレクトリとかは、それぞれの環境に読み替えよろしく。Djangoについて多くは書かないので参考程度に。Windowsでは当然動きませんがあしからず。 projectdir/modules/status.py import os import re def diskinfo(dir): pipe = os.popen('df -h | grep \" %s$\"' % dir, 'r') text = pipe.read() pipe.close() info = re.split('[\s]+',text) if
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く