[jQuery] serializing data from a jquery-rendered form
The goal is a multi-stage process schema where a form is rendered
by a cgi script and inserted into a static web page via this method:
[code]
$(document).ready(function(){
var myscript;
if(document.domain == 'bart.johnson.com') // local
myscript = "http://bart.johnson.com/cgi-bin/woods/phhDonate.r";
else
myscript = "http://www.somedomain/cgi-bin/script.r";
$("#dynamic_content").load(myscript,"task=entry",
function(resp,stat,xhr){
//alert(resp); // leave for testing
}) });
[/code] And is successful.
The second stage is to validate the input form that is rendered by the
method above and write out a review form to the 'dynamic_content'
innerHTML. The form provides an 'onsubmit' handler, called as follows
from the form tag: onsubmit="return CheckForm0(this);"
coded as follows:
[code]
function CheckForm0(myform){ // myform is the 'this' in CheckForm0(this);
if(Check_Form0(myform)){ // validation code
$("#dynamic_content").load(myform.action,$(this).serialize(),
function(resp,stat,xhr){
//alert(resp); // leave for testing
}
);
return false;
}
return false;
} //[/code]
The problem is that $(this).serialize does not provide the encoded
string that the CGI script is looking for. Does jQuery provide a function
to serialize the 'myform' argument?
thanks
tim