JQuery load, getJSON -- JQuery



general load file


<scripttype="text/javascript">

$(document).ready(function() {

$("#copyright").load("copyright.html");

});

</script>

 

<divid="copyright">copyright</div>



getJSON


<scripttype="text/javascript">

$(document).ready(function() {

$.getJSON("data.json", function(json) {

alert(json.name + " " + json.age);

});

});

</script>

 

[data.json]

 

{

"name" : "NEO",

"age" : "11"

}



passing data to the server


<scripttype="text/javascript">

$(document).ready(function() {

$("div").load("test.jsp",{"name":"NEO"});

});

</script>

 

<divid="ajax_content"></div>



덧글

댓글 입력 영역