Hi currently I am working on a jQuery plugin in which I make an API call. Rather than hard coding the URL for the API, I would like it to be relative in terms of the URL of the JS file of the plugin
So say I have the following set up
Page loading the file
http://mydomain1.com
In that page I load
<script src="http://mydomain2.com/Scripts/myPlugin.min.js">
In that JS file, I load the API url as
api_endpoint: "/myApi/api/v1",
I was hoping this would resolve to
http://mydomain2.com/myApi/api/v1
but it resolves to
http://mydomain1.com/myApi/api/v1
Is there anyway in Javascript I can set the domainname relative to the JS File loading the script rather than the page itself ?