I believe the code you are looking for would be something like this

[code]
$('form').submit(function(){
var cell1 = $('#cell1').html();
var div1= $('#div1").html();
var span1=$('#span1").html();
$.ajax({
         type: "GET",
         url : 'urlToGet.php',
         data: 'cell1='+cell1+'&div1='+div1+'&span1='+span1,
         success: function(response){
                 // whatever you want to do with the response
}
});

});
[/code]
On Feb 8, 4:23 pm, Tim Johnson <t...@johnsons-web.com> wrote:
> 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