Sorry I am posting duplicate post. I am beginner in JavaScript (and web programing) and I didn't leant it. I just modify the demo codes without knowing details of code.
I want to collect database of cities from a post website. That website uses select2 jQuery. I know the API URL to all sub-sub category but this API seems expire after short time. Because of this I can't use this API in my project. The API URL is as follows:
https://www. .com/api/ /query?catalog=city&state=XX
or
https://www. .com/api/ /query?state=XX&catalog=city&village=YYYY
where XX is a two digits number ranging from 01 to 40 for example and blank spaces are time-dependence random string. (I know this just by try and error.) and YYYYY is a five digits number ranging from 11111 to 99999 for example. In summary it has 5 dropdown list: State, Township, Region, City, Village.
One example of the above URLs is as follow (in chrome and without any extension .Js or .Json or any.):
[{"id":12345,"text":"city name1"},{"id":12346,"text":"city name2"}]
in HTML it is
<html>
<head>
</head>
<body>
<pre style="word-wrap: break-word; white-space: pre-wrap;">
[{"id":12345,"text":"city name1"},{"id":12346,"text":"city name2"}]
</pre>
</body>
</html>
and after a short time about 1 hour it return
<html>
<head>
</head>
<body>
<pre style="word-wrap: break-word; white-space: pre-wrap;">
{"errorCode":"invalid token"}
</pre>
</body>
</html>
I want to write a loop to collect all these data into a single Json file but stackoverflow posts confused me. Do you have any solution for this?
Is there a simple way just with the knowledge of select2? (knowing that where it store database or etc.)