I'm not sure if it is the cause of your problem, but your solution is needlessly complicated.
- You don't need to make 2 ajax requests. You already have the variables available in javascript so you can use these to modify your
#all-posts
section in thesuccess
function of your first ajax call. Even if you don't have everything available, you should haveprocess/post.php
return it and not make a new request to the server. - You don't need to add session variables to your url. Just start the session in php and you will have them all available. Although this probably does not matter any more as the second ajax call is innecessary.