对话框内容未在一个页面上加载

时间:2011-06-22 22:08:01

标签: jquery ajax wordpress forms dialog

症状 这适用于Wordpress blog,其中有一个链接用于激活包含表单的对话框。链接和对话框可在网站的任何页面上找到。它们由为网站审核者设置的cookie激活。

  1. 条件1 - 首次访问HOME页面时,内容将不会加载到对话框中
  2. 条件2 - 首次访问时,转到主页以外的任何其他主页,对话框内容将按预期加载。
  3. 条件3 - 首次访问时,转到主页以外的任何主页,然后返回主页。内容将按预期加载到对话框中。
  4. 条件4 - 首先转到主页,然后重新加载页面。内容不会加载。
  5. 问题:我正在寻找有关问题可能来源的想法。

    从查看firebug可以清楚地看到.load函数没有将内容加载到页面,见下文。但是,我不太了解使用firebug来检测可能导致问题的原因。 另请注意,这不是cookie问题。 Cookie显示对话框的链接,该部分工作正常。

    加载内容的脚本

    jQuery(document).ready(function ($) {
    $('#testform a').each(function(){
        //set up variables
        var cancel = function() {
            $dialog.dialog('close');
        };
        //identify link to feedback form
            $link=$(this);
        //dialog variables
            $dialog=$('<div id="form1container"></div>')
            .load($link.attr('href') + ' #form_container' ,function(){
                var testformoptions = {
                        target : "#output1",
                        url:    'http://www.business-navigation.com/value/review/form1_processing.php',
                        clearForm:  'true'
                };
                var form2options = {
                        target : "#output2",
                        url:    'http://www.business-navigation.com/value/review/form2_processing.php',
                        clearForm:  'true'
                };
                var form3options = {
                        target : '#output3',
                        url:    'http://www.business-navigation.com/value/review/form3_processing.php',
                        clearForm:  'true'
                };
                jQuery('#myform').ajaxForm(testformoptions);//prepare form
                jQuery('#error_in_text').ajaxForm(form2options);//prepare form2
                $('#confusing_layout').ajaxForm(form3options);// Prepare form 3
                return false;
            })
            .dialog({
                autoOpen:   false,
                buttons: { "Close": cancel, "Cancel": cancel},
                title:  $link.attr('title'),
                width:  600
    
            });
            $link.click( function (){
                $('div#output1, div#output2, div#output3').empty();
            });
            $link.click( function(){
                $dialog.dialog('open');
                $( "#accordion" ).accordion({
                    collapsible: true,
                    active: false,
                    fillSpace: true,
                    clearStyle: true
                });
                return false;
            });
    });
    });
    

    非常感谢任何关于问题可能来源的想法或想法。

    感谢。

1 个答案:

答案 0 :(得分:0)

如果您使用Firefox(您提到过firebug),您可能会使用F5重新加载页面。尝试使用ctrl + F5并检查它是否正常。

相关问题