Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

function loadCompetitionDetails(getUrl){
        jQuery.ajax({
                type : "GET",
                url : getUrl,
                beforeSend: function(){
                        $('#ajax-spinner').show();
                },
                complete: function(){
                        $('#ajax-spinner').hide();
                },
                success : function(response) {
                        $('#' + 'competition-details').html(response);
                },
                error : function() {
                        alert("Unable to get competition history.Please try again.");
                },
        });  
}

function getNextItems(start,end,itemId){
        jQuery.ajax({
                type : "GET",
                url : "/Support/snapdeal-list!fetchCompetitionData?next="+end+"&itemId="+itemId,
                beforeSend: function(){
                        $('#ajax-spinner').show();
                },
                complete: function(){
                        $('#ajax-spinner').hide();
                },
                success : function(response) {
                        $('.valueEnd').text(+end + +10);
                        $('.valueStart').text(+start + +10);
                        var last = $('.valueEnd').text();
                        var temp = $('.totalItems').text();
                        if (parseInt(last) >= parseInt(temp)){
                                $(".next").css("display", "none");
                        }
                        $('#' + 'competition-details').html(response);
                        $(".previous").css("display", "");
                },
                error : function() {
                        alert("Unable to fetch items");
                },
        });  
}
function getPreviousItems(start,end,pre,itemId){
        jQuery.ajax({
                type : "GET",
                url : "/Support/snapdeal-list!fetchCompetitionData?next="+pre+"&itemId="+itemId,
                beforeSend: function(){
                        $('#ajax-spinner').show();
                },
                complete: function(){
                        $('#ajax-spinner').hide();
                },
                success : function(response) {
                        $('.valueEnd').text(+end - +10);
                        $('.valueStart').text(+start - +10);
                        $('#' + 'competition-details').html(response);
                        $(".next").css("display", "");  
                        if (parseInt(start)==11)
                        {
                                $(".previous").css("display", "none");  
                        }

                },
                error : function() {
                        alert("Unable to fetch items");
                },
        });
}

function getDuplicateRecords(startDate, endDate, itemId, row){
        jQuery.ajax({
                type : "GET",
                url : "/Support/snapdeal-list!fetchCompetitionDataTest?startDate="+startDate+"&endDate="+endDate+"&itemId="+itemId,
                beforeSend: function(){
                        $('#ajax-spinner').show();
                },
                complete: function(){
                        $('#ajax-spinner').hide();
                },
                success : function(response) {
                        $(response).insertAfter(row).slideDown("slow");
                        $('tr.diffColor').children('td').css('backgroundColor', '#7F98FA');
                        
                },
                error : function() {
                        alert("Unable to fetch items");
                        return false;
                },
        });
}