title: How to organize the JavaScript Code in ASP.NET MVC applications
body: <p>We are to add some Ajax functions on a view page. Say, click a delete or insert button and an Action will be called to perform a CRUD job behind the scene and then refresh the items list after that operation.</p>
  
  <p>In many existing examples, the javascript code is embeded in the view page within the <code>&lt;script&gt;</code> tag. Since there are usually many functions that one view may need. Say, when insert a record, there will be function to collect the form data, validate the data (this part can be very long), and call the action by <code>$.ajax()</code>. For this reason, we are thinking about place all those javascript into a separate <code>.js</code> file.</p>
  
  <p>So, what is the professional practice in this? Should we place the <code>.js</code> files under the same folder with its <code>Views</code>? Or should be place all of them into the <code>Script</code> folder and reference from there? </p>
  
  <p>Should we create seperate <code>.js</code> files for each individual view or combine all the <code>.js</code> files for different views into a large file?</p>
  
  <p>Also, we love how we can group C# code using <code>#region</code> so as to collapse. Is there anything similar in JavaScript? It just grows lengthy too easily.</p>
  
  <p>Thank you for any helpful advice.</p>