이미 많은 논의가 있었던 것 같지만 코드 작업을 수행 할 수 없습니다.부트 스트랩 탭을 서버 URL에 연결하기
장고 프로젝트 및 템플릿에 부트 스트랩 탭 알약이 있습니다. 장고 프로젝트의 URL에 탭 메뉴 알약을 바인딩하려고합니다. 그리고 클라이언트 측에서 Uncaught Error: Syntax error, unrecognized expression: /employee_user_info/40/
오류를 읽을 수 없습니다.
HTML : 여기 내 코드의 JS
<div class="container">
<h2>{{person_details_form.second_nm_rus.value}} {{person_details_form.first_nm_rus.value}} {{person_details_form.middle_nm_rus.value}}</h2>
<ul class="nav nav-pills">
<li class="active"><a data-toggle="pill" href="#home">Tab 1</a></li>
<li><a data-toggle="pill" href='/employee_user_info/{{employee_unique_id}}/'>Tab 2</a></li>
<li><a data-toggle="pill" href="#menu2">Tab 3</a></li>
</ul>
<div class="tab-content" style="margin-top:2%">
<div id="home" class="tab-pane fade in active">
<div class="container">
<!-- Something -->
</div>
</div>
</div>
장고
url(r'^employee_user_info/(?P<employee_unique_id>\d+)/$',employee_views.profile_user_info, name ='employee_user_info'),
urlconf
var navpills = $('.nav-pills');
$(function() {
// activate tab on click
navpills.on('click', 'a', function (e) {
var $this = $(this);
// prevent the Default behavior
e.preventDefault();
// send the hash to the address bar
window.location.hash = $this.attr('href');
// activate the clicked tab
$this.tab('show'); // The error arises here
});
$(window).bind('hashchange', refreshHash);
// read has from address bar and show it
if(window.location.hash) {
// show tab on load
refreshHash();
}
});
function refreshHash() {
navpills.find('a[href="'+window.location.hash+'"]').tab('show');
}
UPDATE :
응급실 내가 이 탭 2
UPDATE 2
탭 2를 누르면 URL이 http://127.0.0.1:8000/employee_profile_main/40/#/employee_user_info/40/
내 생각은, 벅은 '여기
더 많은 컨텍스트를 제공해야합니다. 정확히 어디에서 오류가 발생합니까? –
아니요, 브라우저에서보고 한 오류의 컨텍스트를 제공하십시오. 무슨 일이 일어날까요? –
줄 옆에 덧글을 추가했습니다. –