Subversion Repositories SmartDukaan

Rev

Rev 11110 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
11015 kshitij.so 1
function loadCompetitionDetails(getUrl){
2
	jQuery.ajax({
3
		type : "GET",
4
		url : getUrl,
5
		beforeSend: function(){
6
			$('#ajax-spinner').show();
7
		},
8
		complete: function(){
9
			$('#ajax-spinner').hide();
10
		},
11
		success : function(response) {
12
			$('#' + 'competition-details').html(response);
13
		},
14
		error : function() {
15
			alert("Unable to get competition history.Please try again.");
16
		},
17
	});  
18
}
19
 
20
function getNextItems(start,end,itemId){
21
	jQuery.ajax({
22
		type : "GET",
23
		url : "/Support/snapdeal-list!fetchCompetitionData?next="+end+"&itemId="+itemId,
24
		beforeSend: function(){
25
			$('#ajax-spinner').show();
26
		},
27
		complete: function(){
28
			$('#ajax-spinner').hide();
29
		},
30
		success : function(response) {
31
			$('.valueEnd').text(+end + +10);
32
			$('.valueStart').text(+start + +10);
33
			var last = $('.valueEnd').text();
34
			var temp = $('.totalItems').text();
35
			if (parseInt(last) >= parseInt(temp)){
36
				$(".next").css("display", "none");
37
			}
38
			$('#' + 'competition-details').html(response);
39
			$(".previous").css("display", "");
40
		},
41
		error : function() {
42
			alert("Unable to fetch items");
43
		},
44
	});  
45
}
46
function getPreviousItems(start,end,pre,itemId){
47
	jQuery.ajax({
48
		type : "GET",
49
		url : "/Support/snapdeal-list!fetchCompetitionData?next="+pre+"&itemId="+itemId,
50
		beforeSend: function(){
51
			$('#ajax-spinner').show();
52
		},
53
		complete: function(){
54
			$('#ajax-spinner').hide();
55
		},
56
		success : function(response) {
57
			$('.valueEnd').text(+end - +10);
58
			$('.valueStart').text(+start - +10);
59
			$('#' + 'competition-details').html(response);
60
			$(".next").css("display", "");	
61
			if (parseInt(start)==11)
62
			{
63
				$(".previous").css("display", "none");	
64
			}
65
 
66
		},
67
		error : function() {
68
			alert("Unable to fetch items");
69
		},
70
	});
71
}
72
 
73
function getDuplicateRecords(startDate, endDate, itemId, row){
74
	jQuery.ajax({
75
		type : "GET",
76
		url : "/Support/snapdeal-list!fetchCompetitionDataTest?startDate="+startDate+"&endDate="+endDate+"&itemId="+itemId,
77
		beforeSend: function(){
78
			$('#ajax-spinner').show();
79
		},
80
		complete: function(){
81
			$('#ajax-spinner').hide();
82
		},
83
		success : function(response) {
84
			$(response).insertAfter(row).slideDown("slow");
85
			$('tr.diffColor').children('td').css('backgroundColor', '#7F98FA');
86
 
87
		},
88
		error : function() {
89
			alert("Unable to fetch items");
90
			return false;
91
		},
92
	});
93
}