Here is my scenario:
-I
am processing an excel file that will take about 10 minutes
-In case of processing, I want to send feedback to the user that we are currently processing
My idea was to use a session that will put the value during processing and get that session using javascript in the current view
Here is my script:
<script type="text/javascript">
$(document).ready(function() {
var element = document.getElementById("progress");
setInterval(
function(){
element.innerHTML = "{{Session::get('progress')}}";
},500
);
});
</script>
And somewhere in my controller, let me just say like this:
$i = 0;
while(!$done){
processingComplicated();
Session::put('progress', $i);
Session::save();
}
And my main view:
<div id="progress">0</div>
Basically, I want the current page to receive session data and update the view (id = "progress"), but that will not change.
It can be done? Thank.
source
share