Automate layer publishing in Geoserver

I have my shapefiles stored in the PostGIS table. now, I need to automate the process of publishing these tables on GeoServer. the overall process is that I am getting geojson from a remote server and storing it in the PostgreSQL database. this is being done using HTML, javascript, and PHP on button click event. now I want to create another functionality to publish newly added tables on GeoServer. I have created a workspace and data store in GeoServer and a bat file to publish these tables. but I want to do it on a button click event. Is there a way to execute the bat file in JavaScript? or any other workaround for the whole functionality?

the curl (.bat file) I am using is (http://www.snippetbymatt.com/2017/03/publish-postgis-layers-in-geoserver.html):

for /f %%a in (<list of tables you want to publish>.txt) do  curl -v
 -u <username>:<password>  -XPOST -H "Content-type: text/xml" -d "<featureType><name>%%a</name></featureType>"
 http://localhost:8080/geoserver/rest/workspaces/<name of
 workspace>/datastores/<name of store>/featuretypes pause