Reputation: 11
I am working on a project in which i give a code
to user he will embed that link in his site and some content
of my site will show on his site .Following is the code
<div id="survey">
<div>
<script type="text/javascript" src="www.example.com/exampleaction"> </script>
</div>
</div>
In c#
public ActionResult exampleaction(){
// Some thing to do which returns javascript as a source
}
and following is the javascript code that written in my file which i want to
send
if(document.getElementById('survey'))
{document.getElementById('survey').style.border='1px solid #ccc';
document.getElementById('survey').style.padding='4px';
document.getElementById('survey').style.width='500px';
document.getElementById('survey').style.fontSize='10px';
document.getElementById('survey').style.color='#666';
}
Upvotes: 0
Views: 1154
Reputation: 30152
return Content("Your Content Here");
however why not just have them style it properly with a link to your css if all you are doing is styling the div? I imagine there's more going on here though than you posted.
Upvotes: 0
Reputation: 31378
You could change your C# method to:
public ActionResult exampleaction()
{
return JavaScript("your JavaScript code.");
}
It's up to you how you populate the string, you could read it in from a text file and return the contents...
Upvotes: 1