I have a some problem about EventSource
. I can easily fetch data, for example I can write the data to console. However, I want to have this data returned from this function. Its not returning, because there is some delay and it returns undefined.
function fetchData(date,lang) {
var source = new EventSource(*URL*.php?sse=y&lang=" + lang + "&date=" + date);
source.addEventListener('message', function (e) {
return e;
}, false);
}
How can I do that?