Pass Array From C# COM object to JavaScript?

别说谁变了你拦得住时间么 提交于 2019-11-30 15:49:13

You can try serializing your data to json and deserializing on the client. jQuery has built in json functions. I've done this with more complex objects, but not with string arrays, though I'd bet that it will work just as easily.

Mandoleen

You can send JavaScript array directly from your activeX method, your function will be:

public ArrayObject getAllFriendlyNames()
{
    //.... the same ...... 
    return Microsoft.JScript.GlobalObject.Array.ConstructArray(friendlyNames);
}

Adding Microsoft.JScript reference to your project.


MSDN: ArrayConstructor.ConstructArray Method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!