asp.net mvc 4 - jQuery in Parent Calling Objects in PartialView -


i have been searching around web , reading articles week on topic, apologize if has been answered somewhere may have overlooked.

i have (potentially) interesting case have asp.net mvc4 (razor) project have created , jquery loaded , executes on parent view able manipulate objects on partial view.

when call partial view this, works dandy:

@{html.renderpartial("ticketlist", "home");} 

however, need ability reload partial's data inside parent on-demand; thus, using code call partial:

<div id="ticketlist"></div>   <script>     function updatetickets() {         $.ajax({             url: '@url.action("ticketlist", "home")',             datatype: "html",             success: function (result) {                 $("#ticketlist").html(result);             }         });     }      updatetickets(); </script> 

my dilemma first piece of code - partial renders great... jquery parent view executes expected; however, second method, jquery not execute. if parent jquery doesn't recognize new code has been loaded via partial.

maybe i'm going wrong way... or advice immensely appreciated!

many :)

as understood question, partial view contains script function updatetickets , call function i.e. script updates partial view. weird approach think. place function updatetickets in parent view , call parent view. , maybe better use

@html.partial("ticketlist", "home"); 

and div should in parent view inside can render partial. can refer this link


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -