function copyToClipboard(element) { var str = document.getElementById("texttocopy").innerHTML; // Create new element var el = document.createElement('textarea'); // Set value (string to be copied) el.value = str; // Set non-editable to avoid focus and move outside of view el.setAttribute('readonly', ''); el.style = {position: 'absolute', left: '-9999px'}; document.body.appendChild(el); // Select text inside element el.select(); // Copy text to clipboard document.execCommand('copy'); // Remove temporary element document.body.removeChild(el); } jQuery(document).ready(function($) { console.log("app.bqn.io"); console.log( $("#affiliate_url").val()); $('#setup-form').on('submit', function(e) { e.preventDefault(); var $form = $(this); $.post($form.attr('action'), $form.serialize(), function(data) { $("#bqnFormWrapper").fadeOut(); //alert('This is data returned from the server ' + data); console.log(data); console.log(data.user); console.log("object keys " + Object.keys(data.user)[0]); var uKey = Object.keys(data.user)[0]; console.log("array access " ); console.log(data.user[uKey]); console.log(data.user[uKey].email); var page = $("#pageAttribute").val(); var affiliate_url = $("#affiliate_url").val(); console.log("page " + page); /* $.each(data.user, function(index, value) { console.log(index); console.log(value); }); */ // var ut = $.data( document.body, "driver_enabled" ); if($('#driver_enabled').prop('checked')) { var ut = 1; } else { var ut = 0; } console.log("ut " + ut); var msgOut = "

Success!

"; if(ut==1) { msgOut += "

Please complete registering by finalizing Driver Details

"; } else { if(page=="affiliate") { msgOut += "

Your affililate details are availabe here: Affiliate Details

"; } else { msgOut += "

Please complete registering by finalizing Metchant Details

"; } } $("#bqnSuccessMessage").html(msgOut); $("#bqnSuccessMessage").fadeIn(); }, 'json'); }); $('#driver_enabled').bootstrapToggle({ on: 'Driver', off: 'Merchant' }); $('#driver_enabled').change(function() { // console.log( $(this).prop('checked')); if($(this).prop('checked')) { var driver_enabled = 1; $("#statusRow").show(); } else { var driver_enabled = 0; $.data( document.body, "driver_status","inactive"); $("#statusRow").hide(); } $.data( document.body, "driver_enabled" ,driver_enabled); }); });