开发者

I want to Know how can i pass the Value of Id which is in ViewData?Please see the below code?

<%#ViewData["id"] %>
<h2>MarkerDetail</h2>
<script language="javascript" type="text/javascript">
    $(document).ready(function(){
        $.ajax({
            url:"/Marker/MarkerDetailPartial",
            data:"",
            success:function(result){
                $开发者_Go百科("#ReplyDetails").html(result);
            },
            error:function(result){
            }
        });
    });
</script>
<div id="ReplyDetails">
</div>

& i want to send Id only By this Ajax


What you need to do is simply write out the value from the viewdata in the appropriate place. Something like this:

....
url:'/Marker/MarkerDetailPartial/<%=ViewData["id"]%>',
....

Or like this:

....
data:{'id':<%=ViewData["id"]%>},
....

Remember that all server side code is already executed and rendered when your javascript executes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜