문제

I need to load some ajax content after the fieldset with the class address. Using the code below it will replace the content of the .address with the ajax content.

    $('.accordion .head').click(function() {
    $(this).next().find('.address').after().load('http://test.dev/search/view/IdDaytrip/' + $(this).attr('id') + '.html');
    $(this).next().toggle('slow');
    return false;
}).next().hide();

<div style="display: none;">
<fieldset class="address">
<!-- AJAx CONTENT GOES HERE -->
    <ol>
        <li>Stadhouderskade 78</li>
        <li> Amsterdam-Zuid</li>
        <li>020-5239666</li>
    </ol>
</fieldset>
<!-- BUT THE AJAx CONTENT NEEDS TO GO HERE -->
<span class="tags">Tags: museum</span>
</div>
도움이 되었습니까?

해결책

I usually do that this way:

var clicked = $(this);
$.get('http://test.dev/search/view/IdDaytrip/' + $(this).attr('id') + '.html',
function(data){
    alert("Data Loaded: " + data);
    $(clicked).next().find('.address').after(data);
});

다른 팁

This should work ..

$('.accordion .head').click(function() {
    $next = $(this).next();
    $.get('http://test.dev/search/view/IdDaytrip/' + $(this).attr('id') + '.html',
          function(data){
                         $next.find('address').after( data );
                        }
         ).end().toggle('slow');
    return false;
}).next().hide()

Nadeem의 답변에 대한 내 의견에 따라 spsecuritytrimmedcontrol .

컨트롤

조건부로 제어의 내용을 현재 사용자로 렌더링합니다. 현재 사용자의 권한이있는 경우에만 PermissionString

콘텐츠는 HTML 코드 또는 다른 컨트롤 일 수 있습니다.

에 다른 permissionString 값을 가진 두 개의 spsecuritytrimmedcontrols에 두 개의 spsecuritytrimmedControls를 넣으려고 할 수 있습니다.

시도하면 예상대로 작동하는지 알려주십시오.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top