2012-07-19 12 views
5

何時間も苦労しています。私はquickload.php直接でアクセスするとTinyMCEをし、そのスクリプト(ワードプレス)jQuery経由でtinyMCEをロードするとブラウザがフリーズします.load()

$('.quickedit_form_' + parentID).load('<?php bloginfo('template_directory'); ?>/ajax/quickedit.php?id=' + parent.attr('id').replace('post-', ''), function(){ 
     tinyMCE.init({ 
      skin: 'wp_theme' 
     }); 
     $.scrollTo(parent, 800, {offset: {left: 0, top: -61}}); 
    }); 

そして、私のPHPページ(quickedit.php)

<?php 

// include WordPress 
require('../../../../wp-blog-header.php'); 

// get post 
global $current_user; 
$id = $_GET['id']; 
$post = get_post($id); 
if ($current_user->ID != $post->post_author) { 
    wp_die(__('Unauthorized access.','sofa')); 
} 

?> 

<h1 class="quickedit_h"><?php printf(__('Editing Post #%s','sofa'), $post->ID); ?></h1> 

<label for="edit_title_<?php echo $id; ?>" class="quickedit_label"><?php _e('Title:','sofa'); ?></label> 
<input type="text" name="edit_title_<?php echo $id; ?>" id="edit_title_<?php echo $id; ?>" value="<?php echo $post->post_title; ?>" class="quickedit_field" /> 

<label for="edit_type_<?php echo $id; ?>" class="quickedit_label"><?php _e('Post Type:','sofa'); ?></label> 
<select name="edit_type_<?php echo $id; ?>" id="edit_type_<?php echo $id; ?>" class="quickedit_select"> 
    <option value="text"<?php selected("text", sofa_post_type()); ?>><?php _e('Blog','sofa'); ?></option> 
    <option value="image"<?php selected("image", sofa_post_type()); ?>><?php _e('Image','sofa'); ?></option> 
    <option value="video"<?php selected("video", sofa_post_type()); ?>><?php _e('Video','sofa'); ?></option> 
</select> 

<div class="quickedit_save"><input type="button" value="<?php _e('Save','sofa'); ?>" class="button-secondary" /></div> 

<?php 
wp_editor($post->post_content, 'edit_content_'.$id, $settings = array(
    'wpautop' => true, 
    'media_buttons' => true, 
    'textarea_name' => 'edit_content_'.$id, 
    'textarea_rows' => 10, 
    'tabindex' => '', 
    'editor_css' => '', 
    'editor_class' => 'edit_content', 
    'teeny' => false, 
    'dfw' => false, 
    'tinymce' => true, 
    'quicktags' => true 
)); 
?> 

<div class="quickedit_save"><input type="button" value="<?php _e('Save','sofa'); ?>" class="button-secondary" /></div> 

<?php wp_footer(); ?> 

が含まれているPHPのページをロードするためにjQueryの負荷を使用していますすべてのものがスムーズにロードされ、遅延や何もロードされません。しかし、jQueryの.load()を使ってアクセスすると、tinymceとボタンのロードに約15秒かかり、FirefoxとChromeの両方で試したブラウザー(ユーザーは何も対話できません)をフリーズします。

なぜこれが起こっている誰もがこれをしようとして時間となって、私にはお勧めできます。.. :(

注:私はquickedit.php直接罰金とクイックTinyMCEの負荷にアクセスクラッシュ/フリーズが起こります。そのjqueryの.LOAD関数から呼び出さ

私はこの問題を引き起こしている可能性が何にどの方向を必要と

+0

.get()と同じ問題があります。私のデバッガでは、jquery.min.ui.jsファイルを読み込んでいる間にフリーズしています - 私はasynchとは関係ありません。ページ上の最初の.get()リクエストでのみフリーズ/ロードが遅くなり、それ以降のリクエストは期待どおりに応答します。私はそれが私のためにプロキシサーバーと関係があると思っています。 – elzaer

答えて

0

私はjQueryの低レベルのAJAXインターフェイスを使用してみます:。?jQuery.ajax

jQuery(function($) { 
    var ajax_url = '<?php bloginfo('template_directory'); ?>/ajax/quickedit.php?id=' + parent.attr('id').replace('post-', ''); //Included for readability 
    //Check if the elem is in the DOM, if so, load it via AJAX 
    if ($('.quickedit_form_' + parentID).length >0) { 
    $.ajax({ 
     url: ajax_url 
     complete: function () { 
      tinyMCE.init({ 
      skin: 'wp_theme' 
      }); 
     $.scrollTo(parent, 800, {offset: {left: 0, top: -61}}); 
     } 
    }); 
    } 
}); 

あなたがエラーに遭遇している理由は、jQuery.loadの複数の引数の性質(それは廃止されたと思われます...?)が同期(ブロッキング)要求を引き起こしている可能性があるためです。

関連する問題