仅输出我的响应jQuery AJAX的特定部分

Hi gladly I only want to output only a specific part of my response.

I only want to output this on my browser: "Order must have a name"

But what I get is this: link: http://i.imgur.com/8OgtcBe.png

As you can see I am also outputting other things as the response to the browser.

Here is my jQuery code:

$('#saveOrder').click(function(e){
    e.preventDefault();
    var form = $('#orderForm');

    var allInput=form.serialize();
    //var allInputJSON = JSON.stringify(allInput);

    console.log('form serialize value:  '+form.serialize());
    //console.log('allInputJSON value:  '+allInputJSON);

    $.ajax( {
           url: absUrl + "/user/orders/update/order",
            data: {'allInput' : allInput},
          success: function( response ) {

          console.log('response value:  '+ response );

             $('#errors').append(
                '<p>'+
                response
                +
                '</p>');

          $('#delete_ordertasks').val("");
            var orderId=$('#id_order').val();

            var $table = $('#taskTable');
            $table.empty();
            loadOrderTable(orderId);
          }
    } );

});

Here is my PHP code:

if (!empty($errors)) {
    //die(' pass confirm val : '. Input::get('password_confirm') ); 
    //return Redirect::back()->with('errors', $errors)->withInput();
    return json_encode($errors);    
}

The variable $errors is an array which holds the element:

"Order must have a name"

The rest of the output are just print statements like:

"load_hour value 3 load_id_task value is 6 key value 0 load_id_ordertask value 31 load_total_salaries value 27"

Gladly I don't want to show the print statements on the browser. Can somebody help me, please?

response is a JavaScript array (hence the square brackets). Try using response[0] and see if that fixes the issue. If there could be more than one item in that array you may need to loop through, appending each array item to the generated string.