Editing base url of the project after each and very deployment is very frustrating and idiotic. There must be a better way to handle these base_url automatically into our js files. Yes, there is a better way, In this tutorial I will show you most used trick. This trick is applicable for any framework or project.
Just add the following code snippet in your master/main layout file, in the head section so that it can be accessible.
What we did – we just declared a JavaScript variable called base_url, that can later be used by external/inline javascript files(variable declaration should be top of all the files).
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
No comments:
Post a Comment