// save the main form
result = saveForm( action, what, main );
// save the available forms
saveForms( 'address' );
saveForms( 'phone' );
saveForms( 'email' );
---------------------------------------
// the string with the POST data
parameters = 'what=company&id=' + generateId();
// add the field names and values to the post data
for( var i = 0; i < form.length; i++ )
{
// save the form field
field = form.elements[i];
// add the field to the string
parameters += '&' + field.name + '=' + field.value;
}
// add the company/contact id
parameters += '&c_id=' + c_id;
// post the data
post = post( action, parameters );
// return the value
return post;
---------------------------------------
// get the xmlHttp object
xmlHttp = getXmlHttpObject();
// open the page
xmlHttp.open( 'POST', '/modules/resources/add.php', false);
// set the request headers
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", parameters.length);
xmlHttp.setRequestHeader("Connection", "close");
// send the data
xmlHttp.send( parameters );
// return the text that's recieved from the server
return xmlHttp.responseText;
|