c# - how to retrieve post request parameter of jquery in aspx page -
i working on project in c#.net , have jquery code in master page , master page included in home page. have created hyperlinks dynamically in home page. want when ever user clicks on hyperlink, instead of wholepage 1 part of page div class=refresh1 reload.
i have include following jquery in head tag.
<script type="text/javascript"> $(document).ready(function () { $("a").click(function () { var link1 = $(".mylink").text(); $.post("loaddata.aspx", { link: link1 }, function (responsetxt, statustxt, xhr) { if (statustxt == "success") alert("done!"); if (statustxt == "error") alert("error: " + xhr.status + ": " + xhr.statustext); $(".refresh1").load('loaddata.aspx .part1'); }); }); }); </script> here mylink class of 'a' tag.
i want when ever hyperlink clicked load refresh1 class part page i.e loaddata.aspx class=part1.
in loaddata.aspx want retrive value of link have passed in post method .how can plzzzzzzzzz reply aasap.
you can use .load() so:
$('a').click(function () { var link1 = $(this).text(); $(".refresh1").load('loaddata.aspx .part1',{ link : link1 },function(data){ //optional callback code }); }); the .load() fires request though. using post, must use .post() , parse data retrieves:
$('a').click(function () { var link1 = $(this).text(); $.post('loaddata.aspx',{ link : link1 },function(data){ $(data).find('.part1').appendto('.refresh1'); }); });
Comments
Post a Comment