【发布时间】:2013-11-27 10:03:48
【问题描述】:
我正在使用 cordova 进行测试,以将简单的文本写入卡片。在我有一个引导按钮上
onclick="write_btn();"
我在 index.js 中添加了
function write_btn(){
alert("Write some to card");
var message = [
ndef.textRecord("hello, world of NFC"),
];
var sMsg;
nfc.write(message,
function(){sMsg="good";alert("Write Succes");},
function(){sMsg="fals";alert("Nothing got written");}
);
console.log("Writing is: "+sMsg);
alert("Writing is: "+sMsg);
}
但没有写任何东西,只有警报。如果我在函数 write_btn 中只有 alert("...") 它会被触发。 ndef 是一个全局变量,对吧?
问候
【问题讨论】:
-
你弄明白了吗?
标签: twitter-bootstrap cordova nfc