calling action from javascript function
I have the same code for another action but its not working can you please help me out. 

  

    $(function () {
        $("img").mouseover(function () {
            giveRating($(this), "FilledStar.png");
            $(this).css("cursor", "pointer");
        });
    
        $("img").mouseout(function () {
            giveRating($(this), "EmptyStar.png");
        });
    
        $("img").livequery("click", function (e) {
            $("img").unbind("mouseout mouseover click");
    
            // call ajax methods to update database
    
            var getRId = $(this).parent().attr('id').replace('CommentRating-', '');
            alert(getRId);
            var rating = $(this).attr("id");
            alert(rating);
    
            var url = '@Url.Action("SetRating", "Home")';
            alert(url);
            var data = { commentRating: rating, postId: getRId };
            alert(data);
            //** above code works perfect, something wrong in post function
            $.post(url, data, function (result) {
               
            });
                });
     });
    
     function giveRating(img, image) {
        img.attr("src", "/Content/Images/" + image)
                   .prevAll("img").attr("src", "/Content/Images/" + image);
     } 

 in above code all values like id and rating works pefect, ulr is perfect but something wrong in function return. what can i do?

calling action from javascript function
===

I have the same code for another action but its not working can you please help me out. 

  

    $(function () {
        $("img").mouseover(function () {
            giveRating($(this), "FilledStar.png");
            $(this).css("cursor", "pointer");
        });
    
        $("img").mouseout(function () {
            giveRating($(this), "EmptyStar.png");
        });
    
        $("img").livequery("click", function (e) {
            $("img").unbind("mouseout mouseover click");
    
            // call ajax methods to update database
    
            var getRId = $(this).parent().attr('id').replace('CommentRating-', '');
            alert(getRId);
            var rating = $(this).attr("id");
            alert(rating);
    
            var url = '@Url.Action("SetRating", "Home")';
            alert(url);
            var data = { commentRating: rating, postId: getRId };
            alert(data);
            //** above code works perfect, something wrong in post function
            $.post(url, data, function (result) {
               
            });
                });
     });
    
     function giveRating(img, image) {
        img.attr("src", "/Content/Images/" + image)
                   .prevAll("img").attr("src", "/Content/Images/" + image);
     } 

 in above code all values like id and rating works pefect, ulr is perfect but something wrong in function return. what can i do?
