+ FormProfileSearchXHR: function(form) {
+ $.ajax({
+ type: 'POST',
+ dataType: 'xml',
+ url: form.attr('action'),
+ data: form.serialize() + '&ajax=1',
+ beforeSend: function(xhr) {
+ form
+ .addClass(SN.C.S.Processing)
+ .find('.submit')
+ .addClass(SN.C.S.Disabled)
+ .attr(SN.C.S.Disabled, SN.C.S.Disabled);
+ },
+ error: function (xhr, textStatus, errorThrown) {
+ alert(errorThrown || textStatus);
+ },
+ success: function(data, textStatus) {
+ var results_placeholder = $('#profile_search_results');
+ if (typeof($('ul', data)[0]) != 'undefined') {
+ var list = document._importNode($('ul', data)[0], true);
+ results_placeholder.replaceWith(list);
+ }
+ else {
+ var _error = $('<li/>').append(document._importNode($('p', data)[0], true));
+ results_placeholder.html(_error);
+ }
+ form
+ .removeClass(SN.C.S.Processing)
+ .find('.submit')
+ .removeClass(SN.C.S.Disabled)
+ .attr(SN.C.S.Disabled, false);
+ }
+ });
+ },
+
+ FormPeopletagsXHR: function(form) {
+ $.ajax({
+ type: 'POST',
+ dataType: 'xml',
+ url: form.attr('action'),
+ data: form.serialize() + '&ajax=1',
+ beforeSend: function(xhr) {
+ form.addClass(SN.C.S.Processing)
+ .find('.submit')
+ .addClass(SN.C.S.Disabled)
+ .attr(SN.C.S.Disabled, SN.C.S.Disabled);
+ },
+ error: function (xhr, textStatus, errorThrown) {
+ alert(errorThrown || textStatus);
+ },
+ success: function(data, textStatus) {
+ var results_placeholder = form.parents('.entity_tags');
+ if (typeof($('.entity_tags', data)[0]) != 'undefined') {
+ var tags = document._importNode($('.entity_tags', data)[0], true);
+ $(tags).find('.editable').append($('<button class="peopletags_edit_button"/>'));
+ results_placeholder.replaceWith(tags);
+ } else {
+ results_placeholder.find('p').remove();
+ results_placeholder.append(document._importNode($('p', data)[0], true));
+ form.removeClass(SN.C.S.Processing)
+ .find('.submit')
+ .removeClass(SN.C.S.Disabled)
+ .attr(SN.C.S.Disabled, false);
+ }
+ }
+ });
+ },
+