Created
January 9, 2017 07:22
-
-
Save wihoho/055a9c4824044aa5a6dae3bd342a2d6c to your computer and use it in GitHub Desktop.
Import words into youdao
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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