0

I have a field in the database that contain a big javascript code. How can I add this code to view ?

 $(document).ready(function() {
   // javascript code from DB in a RaphaelObject property
   "@Model.RaphaelObject";
  });   

Thanks.

2 Answers 2

4

Try @Html.Raw(Model.RaphaelObject)

Sign up to request clarification or add additional context in comments.

Comments

2

remove quotes:

$(document).ready(function() {
    // javascript code from DB in a RaphaelObject property
    @Model.RaphaelObject
});

May be you have encoded the js code string. so maybe HttpUtility.HtmlDecode(Model.RaphaelObject) is needed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.