CryptoJS
js MD5或者SHA1加密遭遇Cannot read property ‘words’ of undefined
星期六, 十一月 29th, 2014 | ajax, html5 | 没有评论
使用 CryptoJS.SHA1(“Message”) 或者 CryptoJS.MD5(“Message”) 加密密码
再使用jquery 的ajax的post提交遭遇Cannot read property ‘words’ of undefined 的情况
在官方查到解决办法:(解决方法也很简单 转成字符串即可)
摘录原文:
Ahh, it’s because the hash you get back is an object (see [https://code.google.com/p/crypto-js/#The_Hasher_Output The Hasher Output]). And when you pass an object to jQuery’s data property, then jQuery tries to convert it to a query string.
You’ll need to make sure the hash has been serialized to a string. For example:
{ key: CryptoJS.SHA1(“Message”) + ” }
– or –
{ key: CryptoJS.SHA1(“Message”).toString() }
Search
相关文章
热门文章
最新文章
文章分类
- ajax (10)
- algorithm-learn (3)
- Android (6)
- as (3)
- computer (85)
- Database (30)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (5)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (186)
- linux (143)
- mac (10)
- movie-music (11)
- pagemaker (36)
- php (50)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (2)
- 低代码 (1)
- 体味生活 (40)
- 前端 (21)
- 大数据 (8)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)