search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to run PHP code without affecting performance

Related article: Angular 5 Restaurant Table Reservation (PHP/MySQL)
Asked by Jason
6 years ago.

Hi there,

My current task is when user clicked the create button, I will send the input into a database, but at the same time I am sending a request to a server and that server will give me response.(This response is no need to show to user)

I have successfully implemented it, however, when I click create, it waited for around 3 seconds to finish. It is a bit slow and I realize that it is all because I need to send request to server and wait for the response. So I just wanna know is it possible to run the php in the back without affecting the whole process?(When user clicked create button, data will be saved to database and display to user, and the php code will still run until it finish.)

Regards,
Jason

Answer posted by Dan Letecky [DayPilot]
6 years ago.

If you don't need to result to continue you can simply open the dialog right away. Don't open the dialog from the response callback.

Instead of this:

this.http.get("/api").subscribe(result => {
  this.openDialog();
});

You can do this:

this.http.get("/api").subscribe();
this.openDialog();

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.