js MD5或者SHA1加密遭遇Cannot read property ‘words’ of undefined

星期六, 2014-11-29 | Author: Lee | ajax, html5 | 5,737 views

使用 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() }

Tags:

文章作者: Lee

本文地址: https://www.pomelolee.com/1398.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Meta