简体   繁体   中英

Script in view not shared by partial view

I have a .js page which I am including in my View using the &ltscript> tag. After an ajax call, I am rendering a partial view in the same view. But the partial view was unable to access the methods from the .js file included in the view.

My understanding was, that, since the partial view is like the .ascx, it acts like a component of the view itself and has complete access to everything in the view (Apparently that's not the case).

I was able to resolve the issue by including the same <script> tag (used in the view) in my partial view.

you can append tha partial view html block in your parent page using JS. than you will be able to access components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM