0

I have a scenario where i need to have raw html in an external js file.

the external js file takes care of initiating jquery ajax request and receiving the out put from ajax call and placing the received output in html . My presentation part is developed using Asp.net MVC. i am not sure which particular component is encoding the HTML, the MVC or JQuery or JSon. As it is external JS i am unable to use Razar methods like HMTL.RAW. I am thinking of using any JQuery helper which will work similar like HTML.Raw.

Regards, Kumar.

1 Answer 1

1

If it has to be in a JavaScript file, make it a giant string

var myCode = "<div>\
<span>foo</span>\
</div>\
<div id=\"bar\">aaaa</div>";

If the file is in the same domain, just make it a txt file or any type of file and read it with an Ajax request.

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

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.