Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I write in MVC.
I have UserControl that has inside only this

UPDATED
<div id="login-container">
    <div id="login">
        <script src="/Scripts/shared/Site.js" type="text/javascript"></script>
        <input type="text" />
    </div>
</div>

When I load this control through Ajax call(I return View("UserControl")), so the script isn't downloaded. The only way to fix it is to write
$.getScript("Scripts/shared/Site.js")

after
$("#container").html(UserControlHtml)

I realize that this happens only when I load UserControl through Ajax call, but I don't understand why. Can someone explain what is going on behind the scene? I want to understand why loading html with script inside it doesn't downloads the script

Thank you
Posted
Updated 31-Jan-11 21:25pm
v3

1 solution

This[^] may help you understand.
 
Share this answer
 
Comments
TheAteist 1-Feb-11 3:28am    
I updated the html that is inside UserControl
I read the post in the link you provided, BUT I still don't understand why the script isn't loaded?
The content of UserControl is inserted in some div(DOM element), so why the script still isn't downloaded?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900