0

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';
 }
0

2 Answers 2

1

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...

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

Comments

0
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.

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.