My whole website is an Ajax website because I have a footer music player.
I would like to add:
@using (Html.BeginScriptContext())
{
Html.AddScriptBlock(
@<script>
@if (Request.IsAjaxRequest())
{
<text>
window.rootQuery = '@Request.Url.Query';
window.rootAction = '@Url.Action("/")';
window.absolutePath = '@Request.Url.AbsolutePath';
</text>
}
</script>,
true);
}
To every page without having to go into my 30+ views and manually do it. I can't just add this to Layout.cshtml because Layout isn't called when you return a partialViewResult which is what my website is doing 90% of the time. Any way to do this?