Right now, when a button is clicked on my page, I want a div to be populated with a lot of HTML-- a small form's worth. The strategy I'm using now implements usage of the .html() JQuery method which passes in this behemoth string:
'<div class="container-fluid">' +
'<div class="row"> </div>' +
'<div class="row"> </div>' +
'<div class="row"> </div>' +
'<div class="col-md-3 col-md-offset-1 col-sm-6">' +
'<select id="measures" class="form-control">' +
'<option>Select a Measure</option>' +
'</select>' +
'</div>' +
'<div class="col-md-3 col-sm-6">' +
'<select id="budgets" class="form-control">' +
'</select>' +
'</div>' +
'<div class="">' +
'<button class="col-md-1 text-center col-sm-2 btn btn-primary" id="createSMSButton">Create Summary</button>' +
'</div>' +
'<div class="">' +
'<button class="col-md-2 col-md-offset-1 col-sm-3 btn btn-primary" id="createBudgetReportButton">Create Budget Report</button>' +
'</div>' +
'<div class="row"> </div>' +
'<div class="row"> </div>' +
'<div class="row"> </div>' +
'</div>';
I don't really like the fact that this string is so bug-prone. I also don't really like the idea of requesting a new .cshtml file from the server, which would take up server/ network time, and force users to wait for an AJAX request to happen. Is there a way to add all this HTML to a div without use of a string this long and delicate and/or slow AJAX requests?