For some time I've been using a little ajax library called AjaxRequest.
Because I'm working with code generation tools, I'd like to make a
first - step switch to jQuery as simple as possible.
A sample AjaxRequest function follows:
  function CheckForm0(theform) {
        AjaxRequest.submit(
          theform
        ,{
          'onSuccess':function(req){
               var res = req.responseText.split('\n')
               document.getElementById("cell1").innerHTML = res[1];
               document.getElementById("div1").innerHTML = res[2];
               document.getElementById("span1").innerHTML = res[3];
               alert(res[0]);
               },
          'onError':function(req){ alert("ERROR: " + req.statusText);}
          }
        );
        return false;
  } // end function
// Form tag follows:
<form method="post" 
action="http://bart.johnson.com/cgi-bin/baker/reb/test-ajax.r"; 
onsubmit="return CheckForm0(this);">
// Note that method, action, and onsubmit parameters are in the tag
// and I would prefer that they remain there. Also the form is referenced
// by 'this' in the onsubmit parameter and passed to the Ajax function.

I'd appreciate pointers to jQuery examples that would help me with the
transition. I'd like an approach that requires as few changes to the form
tag as possible.

Thanks
Tim

Reply via email to