snippets / deleteContactListActual

Language: Javascript - First posted by willowdan on 2008-05-2 19:13 (5 months, 1 week)
Link to the snippet: http://www.friendsnippets.org/snippet/277/

deleteContactListActual

 1 function deleteContactListActual() {
2
3 if (connectionObj.forcedLogout) {
4 isDisconnectedForcedLogout();
5 return false;
6 }
7
8 var fullAddresses = "";
9 var contactListFullAddress = getContactListID(curContactList);
10 var uniqueRef="";
11 var curContactListLoc = curContactList;
12
13 var paramDeleteContactList = 'deleteContactList='+'&userContactListID='+contactListFullAddress;
14
15 new Ajax.Request(contactListDeleteUrl, {
16
17 method : 'post',
18 onLoading: function() {
19 if (!$('splashCommonPage')) {
20 showSplashCommon();
21 }
22
23 },
24 onSuccess : function(xh) {
25
26 hideSplashCommon();
27
28 var output = JSON.parse(xh.responseText);
29
30 if (!connectionObj.forcedLogout) {
31 if (isDisconnectedForcedLogout(output)) {
32 return false;
33 }
34 } else {
35 isDisconnectedForcedLogout(output);
36 return false;
37 }
38
39 if (xh.responseText.toLowerCase().indexOf('error') == -1){
40
41 uniqueRefContactListGroup = curContactListLoc + '_group';
42 uniqueRefContactListGroupTop = curContactListLoc + '_groupTop';
43
44 uniqueRefContactListGroup = uniqueRefContactListGroup.replace(/\s/, '_');
45 uniqueRefContactListGroupTop = uniqueRefContactListGroupTop.replace(/\s/, '_');
46
47 // removal of all ul tags or all contactLists
48 if ($(uniqueRefContactListGroup)) {
49 $(uniqueRefContactListGroup).parentNode.removeChild($(uniqueRefContactListGroup));
50 }
51 if ($(uniqueRefContactListGroupTop)) {
52 $(uniqueRefContactListGroupTop).parentNode.removeChild($(uniqueRefContactListGroupTop));
53 }
54
55 deleteContactListID(contactListFullAddress);
56 }
57
58
59 },
60 onFailure : function(xh) {
61 alert("Oops, there's been an error.");
62 },
63 parameters : paramDeleteContactList
64
65 });
66
67 }
In order to post a comment, you should have a friendsnippet account. Please sign-in.

0 comments

May '08

Common Tags


Related snippets


snippet History

May '08