You are calling raat and assigning whatever it returns to onload
window.onload=raat();
It needs to be
window.onload=raat;
And hopefully you realize that <?php echo json_encode($_SESSION['customer_id']); ?>;
will not keep updating, the value will be the same since it is only added when the page is rendered. If you want to get info when that is updated, you will need to make an Ajax call to the server to get the data.