=============== XML RESPONSE ============== address-22 false Business Test Test ST 000000 Modify ]]> ====================== jQuery STRUCTURE ====================== $(document).ready(function() { $("#add_address_form") .jqDrag('.jq-drag') .jqResize('.jq-resize') .jqm({trigger: '#open_add_address_form', closeClass: 'jqm-close', overlay: 0, onShow: function(h) { h.w.slideDown(); }, onHide: function(h) { h.w.slideUp("slow", function() { if (h.o) h.o.remove(); }); } }); $(".address-modify").click(function() { $.ajax({ type: "GET", url: this.href, dataType: "xml", success: function(xml) { $("/addresses/address", xml).each(function(i) { if ($("error", xml).text() == 'false') { $("#address_update_container").html($("html", $(this)).text()); } }); } }); modify_id = $(this).attr('id'); modify_id = modify_id.replace(/.*-(\d+)(?:-modify)?/g, "$1"); $("#updateAddress input[@name=modify_id]").attr({value: modify_id}); $("#delete_address_button").attr({href: "/ajax.php?action=ajax_process_delete_address&contact_id=5&modify_id=" + modify_id}); return false; }); $("#addAddress").submit(function() { var inputs = []; $(':input', this).each(function() { inputs.push(this.name + '=' + escape(this.value)); }); $(this).parent().jqmHide(); $.ajax({ type: "POST", url: this.action, timeout: 5000, dataType: "xml", data: inputs.join('&'), success: function(xml) { $("#address-none").remove(); $("/responses/response", xml).each(function(i) { id_name = "#" + $("id", $(this)).text(); html = $("html", $(this)).text(); $(html).appendTo('#address_container'); alert('ID: ' + id_name + "\n" + 'Length: ' + $(id_name).length + "\n" + 'ID: ' + $(id_name).attr('id')); $(id_name).highlightFade({start: 'yellow', speed: 1500}); if ($("error", xml).text() == 'true') { setTimeout(function() { $(id_name).fadeOut(2000); }, 2500); } }); } }); return false; }); }); ======================== HTML STRUCTURE ========================

New Address

Description Address 1 Address 2 City State Zipcode Country

close resize
... A while later.... Address - Add Address
Description Address 1 City State Zipcode Modify
$(document).ready(function() { });