开发者

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

开发者 https://www.devze.com 2022-12-28 12:53 出处:网络
<%#ViewData[\"id\"] %> <h2>MarkerDetail</h2> <script language=\"javascript\" type=\"text/javascript\">
<%#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

精彩评论

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