To make AJAX calls, I extract the URL values (built-in identifiers and query string parameters) and store them in hidden inputs. Outside of this small part of the server work, I have a static HTML page.
I am looking for a library that can easily retrieve my client-side URL values. I would like to specify the expected format (template URL, if you wish) /account/{accountId}/edit?param={param}. Then I would like to create an object library on the basis of the actual URL (on the basis window.location) /account/123/edit?param=234and gave me back the object: { accountId: 123, param: 234 }.
It would be nice if the library allowed me to specify the expected type {accountId:int}so that the resulting object would have true, int, float, date, etc.
Is there such a library for client-side JavaScript?
source
share