dimanche 30 novembre 2014

Redirect to URL then update menu ( Ajax) in asp.net


Vote count:

0




I have a problem when the user clicks on the link, it must redirect to the page then update the left-menu.


But when i put the url link in href. it update the menu then rediect to the page. Then, the menu disappear.


The code in the Layout Page



<a class="Tab" href="~/Default1" data-tabid='1'> Link1 </a>
<a class="Tab" href="~/Default2" data-tabid='2'> Link2 </a>
<a class="Tab" href="~/Default3" data-tabid='3'> Link3 </a>

<script type="text/javascript">
$('.Tab').click(function (e) {
// e.preventDefault(); alert($(this).data('taskid'));
$.ajax({
type: "POST",
cache: false,
url: "MenuItem/Menu",
data: { MenuId: $(this).data('tabid') },
dataType: "html",
async: true,
success: function (data) {
$("#menuContent").html(data);
alert('success');
},
error: function () {
alert('error');
}
});

});


</script>


Any help is highly appreciated.



asked 1 min ago







Redirect to URL then update menu ( Ajax) in asp.net

Aucun commentaire:

Enregistrer un commentaire