简体   繁体   English

将字节数组传递给Javascript

[英]Pass Byte Array to Javascript

I am using SignalR for updating fields on client side using Javascript. 我正在使用SignalR使用Javascript在客户端更新字段。 I need to pass byte array as an object property. 我需要将字节数组作为对象属性传递。 But it doesn't seem to be picking up and shows as either undefined or System.Byte[]. 但是它似乎并没有显示为undefined或System.Byte []。 I also tried to create an extra string field in the object and tried to convert byte array to string and pass it. 我还尝试在对象中创建一个额外的字符串字段,并尝试将字节数组转换为字符串并将其传递。 But both techniques are passing unique or undefined characters. 但是两种技术都传递唯一或未定义的字符。 Any suggestions on how to pass data between two sides? 关于如何在双方之间传递数据有什么建议吗?

Base64 encode the string. Base64对字符串进行编码。 Here's a good JS Base64 encoder/decoder: http://jsbase64.codeplex.com/ 这是一个不错的JS Base64编码器/解码器: http : //jsbase64.codeplex.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM