I am try to make Qr code Generator.I have input filed there user enter URL of site and this URL goes in php file via Ajax and php file check validated and return URL link.this result pass into the jQuery('#output').qrcode(url); and result show in div.Problem is when Qr code set in div next time if user update url than again new Qr code generate and result is two different Qr cods.How can i Handel this when user update link than last Qr code image remove and updated Qr Code image show.
i am showing what i have done check my JavaScript and HTML code.
JavaScript
function grcodeg() {
$(document).ajaxStart(function() {
$("#qr-preview").html('<img src="editor/loader.gif"/>').show();
$("#output").css("display","none").hide();})
.ajaxStop(function() {
$("#qr-preview").html('<img src="editor/loader.gif" />').hide();
$("#output").css("display","block").show();
});
$("#qr-form").ajaxForm(function(url){
jQuery('#output').qrcode(url);
}).submit();
}
HTML
<form action="editor/arcode_g.php" method="post" id="qr-form">
<label for="url-qr">Link to a Website</label>
<br>
<input type="url" name="url-qr">
<br>
<label for="label-qr">Add QR Label</label>
Describe what your QR code will do.
<br>
<input type="text" name="label-qr">
<br>
<a onclick="grcodeg();">Ok</a>
</form>
<!----Qr Code Result------------->
<div id="qr-preview"></div>
<div id="output"></div>