Display partialview when clicking a link

后端 未结 2 375
情书的邮戳
情书的邮戳 2021-01-26 01:06

I\'m fairly new to JQuery and MVC 2 which makes this a bit harder, I\'ve always used WebForms before.
I\'m using the NerdDinner example as setup (I\'ve switched Dinner

相关标签:
2条回答
  • 2021-01-26 01:40

    Ignore the Ajax helpers, they're for ASP.NET AJAX scripting.

    Change your link to:

    <%= Html.ActionLink("Details", "Details", new { id = item.id})%> 
    

    And your jQuery to:

        $('tr').click(function() {
            var url = jQuery(this).find('a').attr('href');
            $("#details").load(url)
        });
    
    0 讨论(0)
  • 2021-01-26 01:45

    page1.asp

    <div class="holder">
        <div>1</div>
        <div class="test">2</div>
    </div>
    
    $('.holder').load('page1.asp .test');// returns =>> 2 // .test grabs any element that has a .test and pushes it into the holder

    so page would look like this...

    <div class="holder">
        <div class="test">2</div>
    </div>
    
    0 讨论(0)
提交回复
热议问题