A
A
ahristovsky2016-04-30 13:21:18
PHP
ahristovsky, 2016-04-30 13:21:18

What language to parse in?

Hello. Help please with the decision of a question. It all started with the fact that I wrote a simple php parser. There was a need for the parser to work when the button is clicked. Connected ajax, which sends a request to parser.php. I wanted to make it so that the page displayed how much data was processed and left, but I realized that in this case this would not work, because. the answer comes at the end of the execution of all php code. Then I decided to send one request to ajax, so that php processes one at a time, so it became possible to display on the page how many have already been processed. And now the question has become: why, in this case, use php if you send a request and ask for the data I need, maybe javascript itself. Please tell me the smartest way to implement this.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2016-04-30
@ahristovsky

Let parser.php write data (how much data is processed and how much data is left) to result.json as it works. On the client, just periodically request result.json every N seconds.

V
VZVZ, 2016-04-30
@VZVZ

> if you send a request and ask for the data I need, javascript itself can.
If JS really can (for this, the parsed link must allow cross-domain requests) and if you don’t mind that parsing will create a load on the client and go with its IP, then do it on client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question