Update the database when clicking object without refresh

-4

It is the following people have a data table as you can see below, it has the icon of an eye, which when clicked makes a targeting to another page passing the "id" of the file via url and giving an update in the file line, modifying a field from zero to one, right after done this back to the table page and change eye from blue to red and vice versa, so alright, my problem is the following I wanted to do exactly this process only without running the refresh on the page so that when it clicked it would update and change the color of the icon without the need to refresh the page, would anyone know how I can do this?

    
asked by anonymous 22.10.2017 / 01:28

1 answer

0

In general, you would need to create an endpoint / route on your system, which allows you to do the update you want by passing the id and field value, and returning if the operation was a success. With this done, you, using Javascript, would have to make a request for the endpoint you created (by clicking the button, of course), passing the desired parameters and updating the HTML elements of the page according to the result obtained by the request.

    
22.10.2017 / 02:02