Resume PHP function execution after GUI [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm new to PHP, and I'm trying to achieve this:
The problem is, I don't even know is it possible using any combination of PHP/Javascript or JQuery. Whenever user is redirected to UI, the function state is lost and cannot be resumed from where it left, after the successful completion of UI tasks.
Is there any possible solution to achieve this? I know I can create a new method and call that after user clicks OK. But my requirement is to not breakdown the function in further modules.
Thanks in advance.

No, PHP is a scripting language: script runs, does something and dies. And so on every request. Make your code stateless, we have files and DBs and other storages for state.

Related

How to validate user logged in web application (php)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Good day.
Could someone please tell me how I can control that a user does not enter a web application more than once?
Currently I am controlling it by storing the session that is created in php in a field of a table and through javascript using ajax I consult it every 10 seconds. I think there must be a better way ... thanks !!!
And finally solved it by validating that the session created is different from the previous one, thus updating it and the previous user wanting to validate his session in order to make any request will realize that it does not exist and this will remove him from the application .

Can I use Django/Python API calls, and still use Javascript to manipulate the DOM in real time? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm in a full stack course and would like to use Django/Python to post/get my API calls, but use Javascript/Vue to stay on the same page. Can you still do that by essentially having a one page app that doesn't reload or change url? Just wondering before I go full on with it.
Also, what's a good way to use Javascript to get info onto the DOM from an API using an api key and secret key? I've experimented so much but haven't got back anything useful to my knowledge. Help is appreciated, thank you.

Handling Eventsource using PHP and C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have created a fileWatcher(running as a service) in C# which calls PHP script through URL whenever there is a change in Folder.
I want to load the web page with new data when there is change in file.
I have tried doing this using javascript Eventsource by calling PHP and echoing by C# whenever there is change in file but no luck.
Any suggestions how would I tackle this problem.
I have solved this problem by checking file size every minute and responding to event source. Only overhead is checking file every 1 minute.

Reload page if Database changes [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I can't set a javascript timer to reload the page every X seconds. It must be a perfect loop with no wait times.
I can't use AJAX. When the database changes a full screen video must be played, and there's no way I can load an "auto-fullscreen" HTML5 video from AJAX method through someotherfile.php
I spent 6 hours today trying to find a way to do this. Apparently I can't put PHP in a loop to 'listen' by doing sql queries every now and on. Weak language I guess.
It has nothing in common with PHP weaknesses it's about server side and client side.
Answering your question. You should try using HTML5 server sent events check these links it should clarify you how to do it. There are examples given:
http://www.w3schools.com/html/html5_serversentevents.asp
https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events
BTW you don't need reload page with JavaScript just simple meta referesh does this.
Note: using EventSource is not supported by all browsers.

Javascript + PHP timed actions [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Here is my goal:
Create some JavaScript action (some function call) that will be timed perfectly between two different clients.
Explanation:
I want a function to be called exactly on the same millisecond on two different browsers/computers no matter when the client accessed the web page.
I thought about creating a time base using the server time but im not sure this will work.
I think you should be using something Node.JS or APE (Ajax Push Engine) to achieve this.
so you want to do like this scenario: user come visit your webpage and he has to wait few seconds that page is shown?
This is useless to do in my opinion, unless you want to flood server with tons of requests..

Categories

Resources