我正在制作一个jquery ajax请求,如下所示
修改
点击编辑btn
url_encoded_fmt_stream_map":"url=https%3A%2F%2Fr1---sn-hp57kn7r.googlevideo.com%2Fvideoplayback%3Fipbits%3D0%26mt%3D1451427839%26nh%3DIgpwcjAzLm1pYTA0KgkxMjcuMC4wLjE%26fexp%3D3300134%252C3300137%252C3300164%252C3312381%252C9405265%252C9408540%252C9412777%252C9416126%252C9417056%252C9418184%252C9418222%252C9418400%252C9420452%252C9422596%252C9423662%252C9424552%252C9424823%252C9424981%252C9425381%252C9425403%252C9426538%26sver%3D3%26signature%3DAAC9121A2283672F4C84761DE6CBEF1CE2F5F6F5.E1CC3D9DEEA98D167E7D747990A3F53E00968869%26initcwndbps%3D192500%26key%3Dyt6%26sparams%3Ddur%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cnh%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cupn%252Cexpire%26expire%3D1451449492%26lmt%3D1393704779008322%26ratebypass%3Dyes%26ip%3D98.89.14.143%26mn%3Dsn-hp57kn7r%26mm%3D31%26source%3Dyoutube%26ms%3Dau%26id%3Do-AJfgwitywpU71wLMxgZ4gx6YIYrwD6SiDTmN-gRPsVDi%26pl%3D17%26mv%3Dm%26requiressl%3Dyes%26mime%3Dvideo%252Fmp4%26dur%3D408.531%26upn%3DTYw3Io4raMI%26itag%3D22\u0026fallback_host=tc.v18.cache6.googlevideo.com\u0026quality=hd720\u0026itag=22\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22
使用可编辑字段打开模态窗口,在表单提交中我正在进行ajax调用,如下所示
$('.mymodalbtn').click(function($this){
var id = $this.data('id');
$('[name="id"]').val(id);
});
});
我正在尝试自动关闭模态窗口,如果它成功,则显示错误并停留在模态窗口。
我试过.complete但没有运气似乎出错了!。
我也尝试了.hide()但是然后点击编辑按钮模态窗口没有出现。有人能告诉我怎样才能自动关闭bootstrap模态窗口。
答案 0 :(得分:0)
如果您想在成功回调中自动关闭模态窗口,那么只需执行
$.ajax({
success:function(data){
$('#mymodal').modal('hide');
// Rest of your code.
}
});
答案 1 :(得分:0)
在你的ajax调用中,像这样使用....
$.ajax({
success:function(data){
$.gritter.add({
title: "Student",
text: responseHTML,
time: '1000'
},
complete: function(){
$('#mymodal').hide();
//Here, you are executing your event loop, or in this example the api "hide" for the "#mymodal" id element.
}
}); // I forgot a bracket here, my apologies.