javascript - How to call a action method from Jquery? -
i have action method returns stringbuilder object has html table output. output fired tab click(having n number of tabs, on tab click name of tab passed jquery function). please find below code
<li onclick="binddata1(this.id);" id="tab1"> <a href="#tabs-2">text</a></li>
code:
function binddata1(techname) { $.ajax({ url: '@url.action("actionmethod", "controller")', data: { id: techname } }).done(function() { if (data != undefined) { //bind page } else alert('error'); }); }
function binddata1(techname) { $.ajax({ type: "post", url: '/controllername/actionmethodname', data: { 'techname': "techname" }, success: function (data) { if(data.success) { $("#contentwrapper").html(data); } else { alert('error'); } }), }); }
Comments
Post a Comment