JavaScript cryptography is not a good idea
JavaScript cryptography is not bad per se, it's just ineffective against most commonly considered threats.
If you consider a man-in-the-middle (MITM) to be a threat then SSL/TLS is a much more effective control as otherwise the attacker could substitute the JavaScript for a version which doesn't use encryption.
If you consider malicious software on the client side to be a threat then it could presumably modify the JavaScript any way it likes and your encryption would be useless.
If you consider the server side to be a threat (eg. the client wants the server to store something but not see the content) then it may be effective, but the client needs some other way of ensuring the JavaScript hasn't been tampered with (which isn't an easy problem to solve) and the client needs to manage the key themselves.
In the use case you've described it doesn't sound like client side encryption will really add any additional security. Either way you have to deal with the issue of communicating the key, which will probably depend on the integrity of SSL/TLS regardless. Either the client will have to send the key to the server or the other way around, and even if you use public key encryption to address this you'll still have the issue of ensuring that the public key sent to the client is authentic. You'll most likely just end up reimplementing a typical public-key infrastructure.
All that aside, there's no fundamental issue with performing cryptography in JavaScript, except that:
- It is typically fairly slow by most standards
- Generating cryptographically secure keys can be an issue, particularly in older browsers which don't support certain newer APIs for this task