function mailinglistSubmitXML() { var targeturl = jQuery('#mailinglist-form').attr('action'); var inputs = []; jQuery(':hidden,:text', '#mailinglist-form').each(function() { inputs.push(escape(this.name) + '=' + escape(this.value)); }); var params = '?resp_format=xml' + '&' + inputs.join('&'); mailinglistPost('post', 'xml', targeturl, params); }; function mailinglistPost(type, datatype, targeturl, params) { jQuery('#mailinglist-form-container').html('
Submitting...
'); jQuery.ajax({ type: type, dataType: datatype, url: 'http://www.daveholland.com/proxy.php?url=' + escape(targeturl) + '¶ms=' + escape(params), success: mailinglistParseXML, error: function(XMLHttpRequest, textStatus, errorThrown) { console.debug(this); console.debug(XMLHttpRequest); alert(textStatus + ': ' + errorThrown); } }); } function mailinglistParseXML(xml) { jQuery('hash',xml).each(function() { if ((jQuery('success',this).text()) == 'true') { jQuery('#mailinglist-form-container').html('Success! Check your email inbox.
'); } else { alert(jQuery('base',this).text()); }; }); }