0

わかりました、私はしばらくこれに取り組んできました、そして私は私の髪を引っ張るのに近づいています. これがシナリオです。ディスカッション ボードを作成しています。投稿フォームは AJAX で呼び出されます。ユーザーがフォームを送信すると、警告とコメントを含むダイアログを起動して、必要に応じて編集を確認して続行できるようにします。

問題: くだらないダイアログを起動できません。ここに投稿されたほとんどの jQuery ダイアログの回答を試しましたが、どれもうまくいきませんでした。

ここに主要なコードを掲載していますが、必要に応じてページ全体を掲載します。私はckEditorを使用していますが、このフォームはもともとAJAX呼び出し自体から呼び出されています。

これが問題のコードです。

$('#postComment_' + id).click( function() {
                // Warn the user about submitting. Let them review their comment.
CKupdate()
$('#confirmSubmit').dialog("destroy");
var commentTitle = $('#commentSubject_' + id).val();

// This is the warning dialog that isn't working!

var commentBody = CKEDITOR.instances['comment_' + id].getData();
var NewDialog = $('<div>You are about to submit your comment.</div>'); 
// This will be where the user content will be. I stripped it out until I can get a simple warning to show.
$(NewDialog).dialog({
    modal: true,
    autoOpen: false,
    buttons: {
    'Submit': function() {
        $(this).dialog('close');
        // Just close and submit.
        $('#discussionComment_' + id).ajaxForm({
            beforeSend: function() {
                $('#discussionComment_' + id + ' input:submit').html('Sending...');
                $('#newEntry').attr('id', '');
                                },
            success: function(data) {
                $('#commentBox_' + id).after(data);
                $('#discussionComment_' + id).remove();
                $('#discussionComment_' + id).hide('puff', function() { $(this).remove() }, 'fast');
                $('#content_' + id + ' a.remove').removeClass('remove').addClass('respond').html('Respond');
                $('.expand').show();
                window.location + $('#newEntry');
                $('#newEntry').children().effect("highlight", {}, 3000);
            },
            error: function () {
                alert('There was a problem posting your comment. Please try again.');
            }
             }); // Form submit
            },
            'Edit': function() {
                $(this).dialog('close');
                return false; // Don't submit the form.
            }
            }
        }); 
        return false;
        });// Click to submit form.

わかりました、ここまで来てくれた人に感謝します。私はまた、私が台無しにした他のがらくた、または私が使用した悪いフォームのために肌が厚い. 良い習慣を身につけようとしています。

4

0 に答える 0