This article introduces a different concept of the view engine - a client-side view engine that renders a view in a client browser. In this concept, the model and the controller are still on the server-side. However, instead of the HTML, JSON is generated as an output from the server-side, it is accepted on the client-side, and HTML is generated using the JavaScript templating engine.
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Displaying details of the single JSON object</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/Content/style.css" />
<script src="/scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="/scripts/jquery.loadJSON.js")" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
var id = window.location.href.match("(ID=|id=|/)[0-9]+")[0].match("[0-9]+");
$('div#data').loadJSON('/Company/Data/'+id);
});
</script>
</head>
<body>
<div id="page-wrap">
<div id="contact-area">
<a href="list.html">Back to the list</a>
<div id="data">
<br style="clear:both" />
<h1 id="Name" style="float:left;margin-right:40px"></h1>
<img id="Logo" style="float:left" alt="" src=""/>
<br style="clear:both"/>
<label for="Address">Address:</label>
<span id="Address"></span>
<br style="clear:both"/>
<label for="Contact">Contact by:</label>
<span id="Contact"></span>
<br style="clear:both"/>
<label for="Town">Town:</label>
<span id="Town"></span>
<br style="clear:both"/>
<br/>
<form action="edit.html" method="get">
<input type="hidden" id="ID" name="ID"/>
<input type="submit" value="Edit" class="submit-button"/>
</form>
</div>
<a href="list.html">Back to the list</a>
</div>
</div>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Graduated from Faculty of Electrical Engineering, Department of Computer Techniques and Informatics, University of Belgrade, Serbia.
Currently working in Microsoft as Program Manager on SQL Server product.
Member of JQuery community - created few popular plugins (four popular JQuery DataTables add-ins and loadJSON template engine).
Interests: Web and databases, Software engineering process(estimation and standardization), mobile and business intelligence platforms.