javascript - Passing a link via viewbag MVC RAZOR &amp appearing -


I'm trying to pass from my view to see a view from my controller, link to form of source To be used in an iframe however & amp; It appears that LNK does not work

Controller

  link = "http://example.com/Index?aa=aa&q=bb"; ViewBag.Answer3 = link;  

View

  & lt; Iframe height = "30" id = "audio" src = "" & gt; & Lt; Script & gt; Show Function () {var listen = document.getElementById ("Audio"); Listen.src = "@ ViewBag.Answer3"; ...  

However this does not work and when I look at the debugger, I see it

  listen.src = "http: // example? .com / index aa = a & amp; q = q = bb ";  

Your help tom

The razor automatically for HTML Thanks you can output to any string.

You can stop it with Html.Raw () .
However, you must javascript-encode for quotation marks instead.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -