Nginx - admin-ajax.php - ajax结果返回问题 - wordpress导致Uncaught SyntaxError:意外的令牌<

The problem is that it works ok on my Apache. Nginx returns error with Uncaught SyntaxError: Unexpected token <

Here is my function from Functions.php

function searchranges() { global $wpdb;

 if (strlen($_POST['s'])>0) {
    $postid = $_POST['s'];

    $args = array(
        'numberposts' => 5,
        'post_type' => array ( 'mail'),
        's' => $postid
    );

    // get results

    $the_query = new WP_Query( $args );
    $array = array();
    $i = 0;
    if( $the_query->have_posts() ):
    while ( $the_query->have_posts() ) : $the_query->the_post();

                $array[$i] = array();
                $array[$i]['title'] = get_the_title();
                $array[$i]['permalink'] = get_permalink();



                   $trendingrows = get_field('mail_name') ?: get_field('mail_colo') ?: get_field('mail_lamo') ?: get_field('mail_rug') ?: get_field('mail_ti') ?: get_field('mail_timb') ?: get_field('mail_vin');

                                if($trendingrows)
                                {
                                    $ti =1;
                                         foreach($trendingrows as $rowinttv) {
                                            if ($ti==1)
                                             {
Fetch All the Data Function
                                             }

                                        }
                                }

                $array[$i]['mailtype']= get_field('carp_mail_type');


                $i++;

   endwhile;
    echo json_encode($array); 
   endif;

}
else echo '';
die();

My Scripts.js looks like this

  $( "#rangesearch" ).autocomplete({
            minLength: 3,
        source: function(request, response) {
            $.ajax({
                url: "/wp-admin/admin-ajax.php",
                data: 'action=fm_searchranges&s=' + $("#rangesearch").val(),
                dataType: "json",
                type: "POST",
                success: function(data) {
                                        $("#search_by_results").html("");
                                        $("#search_by_results").show();

                                        for (var i = 0; i < data.length; i++) {
                                            console.log(data[i]['fibretype']);
                                            $("#search_by_results").append('<div class="sbr_row"><img src="/images'+ data[i]['image'].replace('"', '') +'" alt="" /><h2>'+ data[i]['title'] +'</h2><h3>'+ data[i]['type'] +'</h3><a href="'+ data[i]['permalink'] +'">View Mail</a></div><!--.row-->');
}
                        }

    });
}
}).data( "autocomplete" )._renderItem = function( ul, item ) {
    return $("<li></li>")
        .data("item.autocomplete", item)
        .append("<a>" + item.label + "<br>" + item.description + "</a>")
        .appendTo(ul);
};
})

Ok.

We had the autocomplete.min.js inserted into the code which was causing issues/conflict and admin-ajax.php POST action was inaccessible.

Turned off automcomplete and it seems to work now.