ex)
<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2>
<p>
Name: <span id="jname"></span><br>
Age: <span id="jage"></span><br>
Address: <span id="jstreet"></span><br>
Phone: <span id="jphone"></span><br>
</p>
<script>
var JSONObject = {
"name":"John Johnson",
"street":"Oslo West 16",
"age":33,
"phone":"555 1234567"};
document.getElementById("jname").innerHTML=JSONObject.name;
document.getElementById("jage").innerHTML=JSONObject.age;
document.getElementById("jstreet").innerHTML=JSONObject.street;
document.getElementById("jphone").innerHTML=JSONObject.phone;
</script>
</body>
</html>
'Java Programming > JQuery' 카테고리의 다른 글
[JQUERY]RADIO버튼 YES or NO select (0) | 2014.03.10 |
---|---|
[Ajax]로딩.. (0) | 2014.02.28 |
[JQuery] Serialize() (0) | 2014.02.26 |
[JQuery] slideToggle() (0) | 2014.02.26 |
[JQuery] toggle() (0) | 2014.02.26 |