JavaScript Zend-like url helper
Thursday, 16 June 2016, 10:47
In JavaScript, especially when you work with AJAX (many requests to frontend host) and dynamic UI (many requests for assets like images) you have to resolve a lot of URLs. Problem comes, when you have to keep some base of your URLs reference (like web application base URL), or keep your links switchable easily (static hosts balancing). If you are familiar with Zend_Framework, you must know baseUrl() helper for Zend_View. Isn't that a handful thing? Then why not use it in your client scripts as well ? Here I propose my solution for easy URLs resolving that behaves much like Zend_View's baseUrl() helper.
Tags: Code, Zend, JavaScript