<?php $sx=0; $fp = fopen("sample.txt", "r"); while ($line = fgets($fp)) { $sx=$sx+1; $p[$sx]=$line; } print $p[3]; fclose($fp); ?> function sample(){ $.ajax({ url: "ren.php", dataType: "text", cache: false, success: function(data, textStatus){ var str=data; str="dlta"+str+"delta"; $("#memo").html(str); }, error: function(xhr, textStatus, errorThrown){} }); }