ASP .NET MVC; return HTML along with JavaScript
- by effkay
I have a partial view which renders a table.
On page load, I am using JQuery to perform Zebra Stripping on it.
Whenever ajax refreshes the table, DOM elements are updated, but since JQuery code to do the Zebra Stripping is not executed; table looks ugly.
I have tried adding Javascript in my partial view
if( Request.IsAjaxRequest() )
return PartialView( "AdministrationGrid", Users );
but javascript is not executed.
I guess the only way to execute the Javascript as reply is to do:
return JavaScript( "alert( '' )" );
Anyone with an idea how can I achieve this?
I thought about JQuery Live, but it is used to bind itself to events.