个性化阅读
专注于IT技术分析

修复错误:Uncaught SyntaxError: Unexpected token

点击下载

我正在使用Penny拍卖主题, 并且收到以下错误消息:

Uncaught SyntaxError: Unexpected token <     penny_scripts.js:126

当我扩展错误时, 它显示:

(anonymous function)   penny_scripts.js:126
$.ajax.success         smart-updater.js:146
j                      jquery.js?ver=1.11.0:2
k.fireWith             jquery.js?ver=1.11.0:2
x                      jquery.js?ver=1.11.0:4
b                      jquery.js?ver=1.11.0:4

penny_scripts.js的第126行是

var myObj = eval("(" + data + ")");
for (var i = 0; i < myObj.length; i++) <---This line
{
    pid                 = myObj[i].pid;
    rnd                 = myObj[i].rnd;
    remaining_time      = myObj[i].remaining_time;
    current_bid         = myObj[i].current_bid;

如果我警报(数据);然后我得到以下消息

在此处输入图片说明

functions.php的第1092行是:

$info = array(); global $wpdb;
$my_arr = $_POST['my_values'];
$OKOK = $_POST['OKOK'];

foreach($my_arr as $id_plus_rand)
{
$exp = explode("_", $id_plus_rand);
$pid = $exp[0];
$rnd = $exp[1];

//----------------------
$newpid = array();  

$highest_bidder_id  = PennyTheme_get_highest_bid_owner_obj($pid);

if($highest_bidder_id == false) $highest_bidder = "0";
else {

    $s = "select user_login from ".$wpdb->users." where ID='{$highest_bidder_id->uid}'";
    $r = $wpdb->get_results($s); $r = $r[0];
    $highest_bidder =   $r->user_login;

}       

$newpid['highest_bidder'] = $highest_bidder;    
$newpid['highest_bidder_id'] = $highest_bidder_id->id;      
$newpid['pid'] = $pid;
$newpid['rnd'] = $rnd;
$newpid['remaining_time'] = get_post_meta($pid, 'ending', true) - current_time('timestamp', 0);
$newpid['current_bid'] = PennyTheme_get_show_price(get_post_meta($pid, 'current_bid', true));


if($OKOK == "1"):

//$closed = get_post_meta($pid, 'closed', true);
//$post = get_post($pid);               

$bids = "select * from ".$wpdb->prefix."penny_bids where pid='$pid' order by id DESC limit 13";
$res  = $wpdb->get_results($bids);

$all_bids = '';

if(count($res) > 0)
{
    $all_bids .= '<table width="100%">';
    $all_bids .= '<thead><tr>';
    $all_bids .= '<th>'.__('Username', 'PennyTheme').'</th>';
    $all_bids .= '<th>'.__('Bid Amount', 'PennyTheme').'</th>';
    //      echo '<th>'.__('Date Made', 'PennyTheme').'</th>';

    $all_bids .= '</tr></thead><tbody>';
    //-------------

    foreach($res as $row)
    {
        $user = get_userdata($row->uid);
        $s = "select user_login from ".$wpdb->users." where ID='{$row->uid}'";
        $r = $wpdb->get_results($s);

        $all_bids .= '<tr>';
        $all_bids .= '<th>'.$r[0]->user_login.'</th>';
        $all_bids .= '<th>'.PennyTheme_get_show_price($row->bid).'</th>';
        //  echo '<th>'.date("d-M-Y H:i:s", $row->date_made).'</th>';

        $all_bids .= '</tr>';

    }

    $all_bids .= '</tbody></table>';
}
else $all_bids .= __("No bids placed yet.", 'PennyTheme');

$newpid['bidders'] = $all_bids;
endif;

array_push($info, $newpid); 

}
header('Content-type: application/json');   <---Line 1092

smart-update.js的第146行是:

if(es.rCallback && rCallback && es.rCallback.search(rCallback) != -1) {
window[rCallback](data);
} else  { 
es.callback(data);  <---This line
}

plugin.php的1395行:

function remove_menu_page( $menu_slug ) {
global $menu;

foreach ( $menu as $i => $item ) {  <-- This line
    if ( $menu_slug == $item[2] ) {
        unset( $menu[$i] );
        return $item;
    }
}

return false;
 }

仅当我未登录网站或使用用户级别低于贡献者的帐户登录时, 才收到此错误消息。

我不确定为什么会这样或如何解决此问题。任何帮助表示赞赏。


#1


上面的问题是由我在网站上启用的插件引起的。当我更新它时, 错误停止了。 2.19.5或更高版本不会发生该错误。 2.19.5的变更日志

  • “作者删除代码”的”删除个人鉴定”菜单<-这是为我修复错误的更改。
  • 需要Aihrus Framework 1.1.4
  • 修改高级介绍
  • 更新高级链接
赞(2)
未经允许不得转载:srcmini » 修复错误:Uncaught SyntaxError: Unexpected token

评论 抢沙发

评论前必须登录!