Prototype

From Wiki RB4
Revision as of 07:51, 25 May 2007 by 127.0.0.1 (talk) (→‎Using)

Introduction

Library to support AJAX.

Using

Library

just add

<script type="text/javascript" src="prototype.js"></script>

to the header section of the html file.

Making a Request

Is by Definition asynchronous.

new Ajax.Request('<RelativeURL>',
  { method:'get',     
    onSuccess: function(transport)
    {       
      var response = transport.responseText || "no response text";       
      alert("Success! \n\n" + response);     
    },     
    onFailure: function()
    { 
      alert('Something went wrong...') 
    }   
  });