Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

$(function() {
        $('#addPincodeForm').live('submit', function() {
                addPincode($(this).serialize());
                return false;
        });
        
        $('#updatePincodeForm').live('submit', function() {
                updatePincode($(this).serialize());
                return false;
        });
        
        $('#addPincodeLink').live('click', function() {
                $("div#addPincode").show();
                $.colorbox({
            inline : true,
            width : "400px",
            height : "220px",
            href : "div#addPincode",
            onClosed : function() {
                $("div#addPincode").hide();
            }
                });
        });
        
        $('#updatePincodeLink').live('click', function() {
        $("div#updatePincode").show();
                $.colorbox({
            inline : true,
            width : "400px",
            height : "210px",
            href : "div#updatePincode",
            onClosed : function() {
                $("div#updatePincode").hide();
            }
                });
        });
});

function addPincode(params) {
        $.ajax({
                type : "POST",
                url : "/Support/pincode!addPincode",
                data : params,
                success : function(response) {
                        alert("Pincode added successfully");
                        $.colorbox.close();
                },
                error : function(response) {
                        alert("Error in adding pincode" + response);
                        $.colorbox.close();
                }
        });
}

function updatePincode(params) {
        $.ajax({
                type : "POST",
                url : "/Support/pincode!updatePincode",
                data : params,
                success : function(response) {
                        alert("Pincode updated successfully");
                        $.colorbox.close();
                },
                error : function(response) {
                        alert("Error while updating pincode" + response);
                        $.colorbox.close();
                }
        });
}