이 작업을 수행하는 우아한 방법이있을 최대량 : 다른 경우
<li class="dropdown top-dropdown">
<a href="#" class="dropdown-toggle" style="padding-right:0;" data-toggle="dropdown">hola</a>
<ul class="dropdown-menu">
<li>
<a href="/hola"><i class="icon-user"></i>
Profile
</a>
</li>
<li>
<a href="/hola"><i class="icon-wrench"></i>
Settings
</a>
</li>
</ul>
</li>
<li id="hola" class="dropdown">
<a id="go_do_something" href="<%= url %>" class="dropdown-toggle disabled" style="padding-right:0;" data-toggle="dropdown">
<b id="noti_container">
<i class="icon-bullhorn"></i>
</b>
</a>
<ul class="dropdown-menu">
<li>
<a href="/hola">
<i>added on yesterday</i>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
See All
</a>
</li>
</ul>
</li>
$("#go_do_something").live("click", function(){
var update_user_last_n = $(this).attr('href');
$.ajax({
type: 'GET',
url: update_user_last_n
}).done(function(xhr, status) {
$("#hola").dropdown('toggle');
}).fail(function(xhr, status) {
});
});
나는 Bootstrap Docs에서 설명하는 대신 데이터 대상 속성을 사용하여 같은 HREF하려고하지만 브라우저에 오류가 하지만 여기에 문제를 해결할 수있는 해결 방법이 있습니다.
$("#go_do_something").live("click", function(event){
event.preventDefault();
var this_a = this;
var url = $(this_a).attr('href');
$.ajax({
type: 'GET',
url: url
}).done(function(xhr, status) {
$(this_a).removeClass("disabled");
$(this_a).click();
}).fail(function(xhr, status) {
});
});