A LAMP project I am currently working on is pretty well organized on the backend. However, there are a ton of pages that just have a diarrhea of javascript and html squirted all over numerous locations with little discernible architecture, rhyme, or reason. In a few cases, some kind of javascript prototype was created for a common control, and the MVC framework in place is taking care of templating pages. How do we start to get all this spaghetti code under control? On backend projects I would start with getting some unit testing in place, CI, refactor common MVC or model/mapper code out etc..
How to best organize spaghetti Javascript on the client with an MVC server architecture?
javascript;html