Sending JSON Object from Javascript to Silverlight then triggering an event to update Silverlight
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 woul开发者_StackOverflow中文版d 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
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.
精彩评论