If you have enabled the CORS policy headers then you can directly add a product via link given below;
Site-url.com/?add-to-cart=PRO-ID&variation_id=ATTR-ID&quantity=1&attribute_YOUR-ATTR-NAME=ATTR-VALUE
Trigger this url for an ajax / windows location
on an action in your javascript.