likcop
likcop

Reputation: 51

Add QR code in jquery

I am new in jquery and working on how to add QR code in jquery.

I have the following jquery code

var streamFile = function(p) 
{
    uploadPath = p;
    $.prompt("<center><b>Enter the URL in stream apps</b> <br>" + p + "</center>", 
    {
        buttons : 
        {
            "OK" : true,
            "Cancel" : false
        },
    });
    return false;
}

where variable p has file URL.

I have found few library to create qr code. Click Here

My problem is how do i convert p into QR code and add it to jquery

Please help

Thanks in advance.

Upvotes: 0

Views: 631

Answers (1)

Cory
Cory

Reputation: 1283

You will need a custom jquery script for making the QR code - I use this one. It is small and very simple to use, and MIT. Download the script, add it to the root dir, and add it to your head:

 <script type="text/javascript" src="jquery.qrcode.min.js"></script>

Then make a <div id="qrcode"></div> for where the QR code will appear

Then, make your text, or in your case a link into a QR with this command:

 $('#qrcode').qrcode("The stuff you want converted")

In your case, it may be:

 #('#qrcode').qrcode(p)

Upvotes: 2

Related Questions