I am attempting to have updates sent whenever they are available from the server utilizing Javascript and PHP. It works as it is supposed to. The basic oulite of the code is as follows
My code simplified looks like this
var sourceCallUpdater = new EventSource("./js/newmessage2.php");
sourceCallUpdater.addEventListener('NewCall', (e) => {
//The returned information is processed and updated to the clients page with code in here
});
The problem I am having is that while the client is waiting for the server to respond back I can not run any other javascript actions locally. For instance I want to update another part of my page with the following code
function GotoPage(Page) {
// alert("./pages/" + Page + ".php");
$.post("./pages/" + Page + ".php", { },
function(data) {
$('#Content').html(data);
});
}
The code works when the client clicks on a button that calls the GotoPage(Page) function, however it will not execute the task until the server has returned the response for the Eventsource called at the start of this question.
Any suggestions. I need to be able to do both at the same time.