tags:

views:

17

answers:

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

& i want to send Id only By this Ajax

+1  A: 

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.

Mattias Jakobsson