Ebleme Ebleme - 13 days ago 7
Javascript Question

asp.net mvc passing any data from a partial view that is rendered with $.get() to ContentPage

I am trying to make my web application like a desktop application.

I am also not using any

_LayoutPage
and
@RenderBody()
.

I have a
ContentPage
as MasterPage and a tag named
main


I am using
ajax get
method to render my views or partial views like this:

$.get(url).done(function (result) {
$("main").html(result);
});


I managed to inject my
script
and
css
files with javascript functions.

And now I want to pass some specific datas without using javascript functions.

It can be via using ViewBag, I guess.

I want to pass that data from my
partialView
:


ViewBag.BodyClass = "signup-page";



to my
MainPage
like this:


<body class="@ViewBag.BodyClass">



How can I do that?

A little note: Please ignore that I am a newbie and my low reputation

Answer

I wrote that code on my partialView. It adds a class at ContentPage's body tag

$("body").addClass("signup-page");