Sending JSON Object from Javascript to Silverlight then triggering an event to update Silverlight

烈酒焚心 提交于 2020-02-04 05:34:08

问题


I am building a web application that basically consists of a set of HTML forms that, when the user updates them, updates a client-side Javascript Object Literal. That Object Literal is then converted to a JSON string and passed to the server for processing upon form submission.

User fill out form -> local javascript updates client-side JS Object Literal -> user presses submit -> JS Object Literal Converted to JSON object -> JSON Posted to Server -> server processes JSON object

Part of this application includes a visualization of the contents of the form. The visualization is very simple, consisting of a set of concentric circles. I am currently using HTML5 Canvas to create that visualization but would like to change the viz to utilize Silverlight as I would get better cross-browser results with hopefully less code.

My question is if it is possible to send a JSON string to a Silverlight application that is embedded in my client-side form and then trigger an event that updates the viz once that JSON object is received...all without a page reload.

Is this even possible with Silverlight and javascript? If so, a tutorial that covers this would be very helpful.

PS: I am using Visual Studio 2010 if that makes a difference.

TIA


回答1:


Yes, you can do that - the HTML Bridge is a feature in Silverlight which allows JS code to call SL functions and vice-versa. Take a look at the link above for more information.



来源:https://stackoverflow.com/questions/6460431/sending-json-object-from-javascript-to-silverlight-then-triggering-an-event-to-u

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