There is a question bothering me, pls help! I use jquery's ajax to call a php api.
$.ajax({
type:"POST",
dataType:"json",
data:{type:type,fid:fid,model:'star'},
url:'Recommend/Star/mark',
success:function (data) {
//do something
},
...
});
php code in Recommend/Star/mark method:
error_reporting(0);
set_time_limit(0);
ob_implicit_flush(true);
ob_end_clean();
ob_start ();
echo json_encode($boolMark);
ob_flush();
flush();
sleep(3);
$this->afterMark($uid, $fid);
I want php echo result to ajax immediately, but my codes do not work.
How to make php send result to ajax immediately, and continue to execute remaining code?