Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果使用.Load()加载内容,则在模态onSubmit中加载内容_Javascript_Jquery_Twitter Bootstrap_Joomla_Joomla2.5 - Fatal编程技术网

Javascript 如果使用.Load()加载内容,则在模态onSubmit中加载内容

Javascript 如果使用.Load()加载内容,则在模态onSubmit中加载内容,javascript,jquery,twitter-bootstrap,joomla,joomla2.5,Javascript,Jquery,Twitter Bootstrap,Joomla,Joomla2.5,我们目前正在将内容加载到Twitter引导模式框中的iframe。但是,由于我们加载内容时使用了Joomla的仅内容后缀:?tmpl=component,因此无法执行样式 <?php echo '… $("a[data-toggle=\'"+$modalText+"\']").on(\'click\', function (e) { // Call the modal manually var url = $(this).attr(\'href\'); $modal

我们目前正在将内容加载到Twitter引导模式框中的
iframe
。但是,由于我们加载内容时使用了Joomla的仅内容后缀:
?tmpl=component
,因此无法执行样式

<?php echo '…
$("a[data-toggle=\'"+$modalText+"\']").on(\'click\', function (e) {
    // Call the modal manually
    var url = $(this).attr(\'href\');
    $modal.find(".modal-body-content").html(\'<iframe frameborder="0" width="100%" height="700" allowtransparency="true" src="\' + url + \'"></iframe >\');
    $modal.modal("show");
});
…';?>
如果希望“在模式内提交”,则应阻止默认表单提交(这将触发整个页面加载),并改为发送ajax请求

您可以手动执行此操作,或者使用jQuery表单插件(您可以找到它)并调用
.ajaxForm()


您还可以编辑模板目录中的component.php以包含CSS文件。这样可以避免在jQuery中编写任何代码;)

//to be called once, when the form is present in the DOM
$('#myForm').ajaxForm({
    success: function(data){
       //code to execute when submit successfully returned from server
       //the "data" variable contains whatever the answer is : html, json ...
    }
    //you define here any option of the "$.ajax()" function
});