In the MVC project I have an assignment:
ViewBag.SomeOne = "one";
ViewBag.SomeTwo = "two";
On the page, I'm displaying the first directly:
<div id="one">@ViewBag.SomeOne</div>
The other, isn't displayed at first. I've been instructed to create a jQuery expression that combines the two and creates a DIV element with them in it upon a click on the visible one. So I went:
<script type="text/javascript">
$(document).ready(function () {
$("#one").click(function () {
var toghether = "";
$("#both").append(together);
}
}
</script>
Now, the problem is that I can't find a nice way to access the value of ViewBag.One and can't find any way to access the value of ViewBag.Two.
I went cheating like this:
$("#one").text();
How can I make it better? And how can I access the other?