So there is this 3rd party website that contains a button that, when clicked, sends a GET request and performs some server-side task which updates the logged in user's data into its database. This desired task has to be performed on every calendar day. Is there an alternative way to making this website's server perform the task without making it load the page for each of the calendar days? The URL attached to that button seems to be using REST API because the button element has href
URL which contains a path + arguments. Currently, my solution to making it perform that server-side task for me is to change the URL's argument and open that URL in a new browser tab.
To be more precise the url looks something like this: https://something.com/somepath/47240/6/sort?date=2018-03-06&crumb=JMBuREVDPqS
I discovered that simply changing the date argument to the next day and loading that URL in the browser will make this website's servers perform the desired task for the next day too. Is there a way to make it perform this task in the background without loading a separate tab for each day or is manipulating the date argument and opening that updated URL in a separate tab the only solution? Since my current method simply opens up the updated date URLs, it was implemented purely through client-side code. So I would like to know of alternative solutions using client-side code only.
You can do something like this
1) Set interval to call the function once in a day
2) The date has to be dynamically increased after calling the function each day
Following is the sample code, which you can modify according to your case.
If you are facing issue with
CROSS DOMAIN
request, you can achieve this using hiddeniframe
like following.Plunk
Use Ajax