Sunday, July 30, 2006
prototype.js
prototype.jsを使ってPOSTでデータを送信するプログラムを作るとき、methodは'post'のように小文字で書かないといけないので注意。
以下サンプル。
function upload(){
 var url="http://address";
 var body = "This is body.";
 var myAjax = new Ajax.Request(
   url,
   {
     method: 'post',
     postBody: body,
     onComplete: function(){
         alert("complete");
       },
     onFailure: function(){
         alert("failure");
       },
     onException: function( o, e ){
         alert("exception: " + e);
       },
     onSuccess: function(){
         alert("success");
       }
   });
}
Subscribe to:
Comments (Atom)