Skip to content

Instantly share code, notes, and snippets.

@wihoho
Created January 9, 2017 07:22
Show Gist options
  • Save wihoho/055a9c4824044aa5a6dae3bd342a2d6c to your computer and use it in GitHub Desktop.
Save wihoho/055a9c4824044aa5a6dae3bd342a2d6c to your computer and use it in GitHub Desktop.
Import words into youdao
function addWord(word){
console.log(word);
$.ajax({
type: 'GET',
url: 'http://dict.youdao.com/wordbook/ajax',
dataType: 'json',
data:{action:'addword',q:word,date:new Date(),le:'eng'},
// beforeSend: ajaxBeforeFn,
success: function(data){
if (data.message == "adddone") {
console.log('insert ' + word + ' is successful.');
}else{
console.log("第" + num + "行" + $a[0] + "| 插入失败,请查看....");
}
},
error: function(data){
console.log(data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment