javascript
1 var applicationkey = "00d239b7e135bedb216bb35159e5e111a9538adee21f5d5d3e1bbd9ef3d7f82a"; 2 var clientkey = "d7c623a691bca31142aa99f53b77b9ca5515a4aaacc61d77e2a5bf8a07177c20"; 3 4 var ncmb = new NCMB(applicationkey, clientkey); 5 var name; 6 var escape; 7 var gender; 8 var nursing; 9 var allergy; 10 var address; 11 var birthday; 12 13 function send_to_datastore() { 14 var User_intel = ncmb.DataStore("user_intel"); 15 var user_intel = new User_intel(); 16 17 name = document.querySelector('#name'); 18 escape = document.querySelector('#escape'); 19 gender = document.querySelector('#gander'); 20 nursing = document.querySelector('#nursing'); 21 allergy = document.querySelector('#allergy'); 22 var address_tmp0 = document.querySelector('#address0'); 23 var address_tmp1 = document.querySelector('#address1'); 24 var address_tmp2 = document.querySelector('#address2'); 25 var address_tmp3 = document.querySelector('#address3'); 26 var address_tmp4 = document.querySelector('#address4'); 27 address = address_tmp0.value + address_tmp1.value + address_tmp2.value + address_tmp3.value + address_tmp4.value; 28 29 var yyyy = document.querySelector('#yyyy'); 30 var mmmm = document.querySelector('#mmmm'); 31 var dddd = document.querySelector('#dddd'); 32 birthday = yyyy.value + mmmm.value + dddd.value; 33 34 user_intel.set("name", name.value) 35 .set("birthday", birthday) 36 .set("escape", escape.value) 37 .set("gender", gender.value) 38 .set("nursing", nursing.value) 39 .set("allergy", allergy.value) 40 .set("address", address).save(); 41 alert("更新成功"); 42 43 } 44 45 function getUrlVars() { 46 var vars = [], 47 hash; 48 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 49 for (var i = 0; i < hashes.length; i++) { 50 hash = hashes[i].split('=');bileb 51 vars.push(hash[0]); 52 vars[hash[0]] = decodeURIComponent(hash[1]); 53 } 54 return vars; 55 } 56 57 $(function() { 58 // クエリ文字列から値を取得 59 var queryString = getUrlVars(); 60 // 値を設定 61 $('.form-row .name').text(queryString.name); 62 $('.form-row .address').text(queryString.address); 63 $('.form-row .gender').text(queryString.gender); 64 $('.form-row .escape').text(queryString.escape); 65 $('.form-row .nursing').text(queryString.nursing); 66 $('.form-row .allergy').text(queryString.allergy); 67 $('.form-row .birthday').text(queryString.birthday); 68 69 var qrCodeText2 = [queryString.name, queryString.address, queryString.gender, queryString.escape, queryString.nursing, queryString.allergy, queryString.birthday].join('、'); 70 71 $('.qrcode').qrcode({ 72 width: 180, 73 height: 180, 74 text: Encoding.convert(qrCodeText2, 'sjis') 75 }); 76 77 }); 78 79``````HTMLで作成した入力フォームのテキストデータをQRコード化して表示するプログラムをjavascriptで作っていいるのですが、QRコード内にテキストデータが入りません。原因をどなたか教えてください。 80 81 82```HTML 83<!DOCTYPE HTML> 84<html> 85 86<head> 87 <meta charset="utf-8"> 88 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 89 <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: content: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> 90 <script src="components/loader.js"></script> 91 <link rel="stylesheet" href="components/loader.css"> 92 <link rel="stylesheet" href="css/style.css"> 93 <link rel="stylesheet" href="lib/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.css"> 94 <script src="lib/jquery/jquery-1.12.4.min.js"></script> 95 <script src="lib/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.js"></script> 96 97 98 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script> 99 <script src="https://cdnjs.cloudflare.com/ajax/libs/encoding-japanese/1.0.30/encoding.min.js"></script> 100 101</head> 102 103
回答1件
あなたの回答
tips
プレビュー