Click here to Skip to main content
15,907,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using zero clipboard for copy clipboard
I like to assign value for copy clipboard from data base value using ajax post method.
so while clicking the button i ll hit the database and retrieve the value and assign to zlip copy function.
Its retrieve value from db but not properly assigned for copy clipboard .
Is there any option for assign the value directly from db to clipboard




$(document).ready(function() {
$(".test").zclip({
path: 'js/ZeroClipboard.swf',

copy: function() {
var i = $(this).next().val();

var j = BindTagOnEnter(i);
alert(j);

}


});
});



function BindTagOnEnter(selectedText) {
var i;
alert('to');
$.ajax({
type: "POST",
url: "Default.aspx/copymethod",
data: "{ 'selectedText': '" + selectedText + "' }",
contentType: "application/json;char-set=utf-8",
dataType: "json",
async: true,
success: function Success(data) {
$("#hdnid").val(data.d);
i = data.d;
}


});

return i;



}
Posted
Updated 15-Aug-13 22:54pm
v2

1 solution

C#
it ll help u        




     $(".test").zclip({
                path: '../Scripts/ZeroClipboard.swf',

                copy: function() {

                    var Id = $(this).next().val();
                    var passpharse = $("#ctl00_ContentPlaceHolder1_hdnPasswordPhrase").val();
                    
                    GetValueFromDb(Id, passpharse);
                    return $("#hdnpass").val();

                },
                afterCopy: function() {

                    $("#hdnpass").val("");

                }

            });

        });



        function GetValueFromDb(selectedText, pharse) {


            $.ajax({
                type: "POST",
                url: "LoginManager.aspx/copymethod",             
                data: "{'selectedText':'" + selectedText + "','pharse':'" + pharse + "'}",
                contentType: "application/json;char-set=utf-8",
                dataType: "json",
                async: false,
                success: function Success(data) {
                    $("#hdnpass").val(data.d);
                }

            });
        }
<pre lang="Javascript">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900