我使用bootstrap remote tabs插件,需要将START_REDELIVER_INTENT
模态框链接加载到每个远程标签中,如下所示:
HTML:
$.ajax
JS:
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">No remote data</a></li>
<li><a href="#simple" data-toggle="tab" data-tab-url="remote/normal.html">Simple remote data</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="home">
<p><a href="javascript:void(0)" id="71" class="push info" title="Full Image">check modal</a></p>
</div>
<div class="tab-pane" id="simple"></div>
</div>
实际上第一个标签是工作的并且显示远程值到modalbox但是当我点击另一个标签我看到链接但是在点击之后,modalbox没有显示而且不能使用远程链接。怎么解决这个问题?
注意:请单击$(document).ready(function() {
$(function() {
$('.push').click(function(e) {
e.preventDefault();
var id = $(this).attr('id');
$.ajax({
type: 'post',
url: 'remote/remote.php', // in here you should put your query
data: {'bookid' : id,'lang' : 'en'}, // here you pass your id via ajax .
// in php you should use $_POST['post_id'] to get this value
success: function(r) {
// now you can show output in your modal
$('#bookdetails').modal({
backdrop: 'static',
keyboard: false
}) // put your modal id
$('.something').show().html(r);
}
});
});
});
});
链接以获取远程选项卡
直播demo
答案 0 :(得分:1)
发现了这个问题。在第一个选项卡中加载页面时绑定public class SimpleFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
String aaa = savedInstanceState.getString("AAA");
Toast.makeText(getActivity(), aaa, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "NULL", Toast.LENGTH_SHORT).show();
}
Log.d("LOG", "onCreate");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d("LOG", "fragment onCreateView");
return inflater.inflate(R.layout.simple_fragment, null);
}
@Override
public void onDestroyView() {
super.onDestroyView();
Log.d("LOG", "fragment onDestroyView");
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("AAA", "Hello");
}
}
元素,因此第一个模式正在工作,而在第二个选项卡中,这个远程选项卡中的.push
元素未绑定。所以
你的JS应该是这样的:
.push