$.ajax({ type: "POST", url: "---", beforeSend: function(){ d = new Date(); start_time = d.getTime(); }, success: function(res){ d = new Date(); alert (d.getTime() - start_time); } });