There is, for example, the php page

echo "результат1"; echo "результат2"; 

and ajax request to it

  $.ajax({ type: "POST", url: "editcodeoutput.php", data:"post="+id, success: function(result) { $('#note').val(result); } }); 

In this situation, both results will be sent to the value of #note , and how, for example, I insert the first echo into one field and the second into the second.

To get something like this

 $.ajax({ type: "POST", url: "editcodeoutput.php", data:"post="+id, success: function(result) { $('#note').val(result); $('#enot').val(result2); } }); 

    1 answer 1

    Use json.

     echo json_encode(array('result1'=>'Результат 1', 'result2'=>'Результат 2')); 

    In $ .ajax, add dataType: 'json' , then at the entrance to the success will be deserialized json. The error function can catch the wrong json.

     $.ajax({ type: "POST", url: "editcodeoutput.php", data:"post="+id, dataType:'json', success: function(data) { $('#note').val(data.result1); $('#enot').val(data.result2); } });