Hi folks,
I'm trying to create a route and then programatically retrieve the url of that route (so i can pass it to my jquery-rater.js code).
So, i wish to have the following url: /vote/create The user will need to HTTP-POST to it. Posting the two values: 1. PostId 2. Vote Score (byte from 1<->5).
This is my route info:
routes.MapRoute(
"Vote-Create",
"vote/create/",
new {controller = "Post", action = "VoteCreate"}
);
This is my action method (which I'm also not too sure if it's right).
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult VoteCreate(int postId, byte score)
{ .. }
Finally, this is where I need to determine the uri (and i'm not sure how) :-
<script type="text/javascript">$(function()
{ $('#rating<%= Model.Post.PostId %>')
.rater({ postHref: 'URI IN HERE' }); });
</script>
At first, I thought I might use the <%= Html.BuildUrlFromExpression(..) %> but i'm not sure how.
Is there a better / proper way?
Thanks folks :)