Jquery意外标记<;


Jquery unexpected token <

我有一个返回的间隔检查和意外的令牌错误。我每秒都会调用admin-ajax.php,每次检查都会得到一个整数值+1。我已经检查了会话变量的输出,我正在使用该变量从另一个函数传递过来,这很好。我知道我已经接近成功了——只是在最后一关失败了。任何帮助都会很棒。

Jquery后调用函数为:

 var cjd_interval = null;
function cjd_interval_checker(){                 
            var cjd_email_fans_nonce  = $("#cjd_email_nonce").val();
            var data = {
                'action': 'cjd_update_progress_bar',
                nonce: 'cjd_email_nonce'
            };
            $.post(cjdAjax.ajaxurl, data, function(response) {
                var result = jQuery.parseJSON(response);
                console.log(result);
                $("#cjd-progressbar").attr('value', result);
            });
        };

PHP函数是:

function cjd_update_progress_bar() {
  /**
   * Check Permissions
   */
  if( current_user_can( 'manage_options' ) ) {
  $count = $_SESSION['counter'];
  echo json_encode( $count );
  }
  wp_die();       
}
add_action( 'wp_ajax_nopriv_cjd_update_progress_bar', 'cjd_update_progress_bar' ); 
add_action( 'wp_ajax_cjd_update_progress_bar', 'cjd_update_progress_bar' );
$.post(cjdAjax.ajaxurl, data, function(response) {
    var result = jQuery.parseJSON(response);
    console.log(response);
    $("#cjd-progressbar").attr('value', response);
});

你们错别字了,你们在回复的背面输入了结果。

    $("#cjd-progressbar").attr('value', response);

这可以更改为:

    $("#cjd-progressbar").val(response);