Hi,
I'm trying to initialize a jQuery call with some parameters, but I don't know how to access them.
Now I have:
// Controller code
public ActionResult Offer()
{
...
ViewData["max"] = max;
ViewData["min"] = min;
...
return View(paginatedOffers);
}
// View Code
script type="text/javascript">
$().ready(
function() {
// Slider
$('#slider').slider({
min: %= Html.Encode(ViewData["min"]) %>,
max: %= Html.Encode(ViewData["max"]) %>
});
});
/script>
But I noticed that I don't have access to ViewData inside the script tag.
Is there a mistake on my side? Can you point me in the right direction, please?
(I'm new to ASP/C#).
Thank you, M.
Edits: Start of script tag and ASP intentionally left out.