Trying to improve my coding styles I\'ve tried different solutions but I can\'t figure out what is the best.
I\'ve started putting JavaScript inside my views but I don\'
Personally I always put javascript in separate files. Global variables which depend on routing or some server side information inside the view. Exactly as you do. As an alternative to storing global variables you could use anchor or form elements which already contain the url and then ajaxify them. As far as model values are concerned they could be stored also in DOM elements such as hidden fields, CSS classes, HTML5 data-* attributes, ... but this might not be applicable to all situations.