<script type="text/javascript">
$.ajax({
type:'POST',
url: 'http://localhost/getpost.php',
dataType: 'json',
timeout: 10000,
beforeSend: function(x) {
if(x && x.overrideMimeType) {
x.overrideMimeType("application/json;charset=UTF-8");
}
},
success: function(data){
//alert(data[0].no); // 여기서는 무조건 data[0] 이렇게 인덱스를 지정해 줘야한다.
for (var i= 0;i<data.length ;i++ )
{
alert(data[i].season);
}
},
error: function(request, textStatus, errorThrown) {
alert('error:'+textStatus);
},
});
</script>
이런 식으로 php페이지의 값을 읽어 왔습니다 . 제가 궁금한점은
html 페이지내에
<body>
<div data-role="content" data-theme="d">
<h1 align="center"><strong>사랑해요</strong></h1>
<div id="firstpane" class="menu_list"> <!--Code for menu starts here-->
<p class="menu_head">news-1</p>
<div class="menu_body">
<p>
이곳 p태그 사이에 값을 넣고 싶은데 도대체 어떻게 해야할지를 모르겠습니다..ㅠㅠ 스크립트가 끝나면서 위에서 읽은 값이 없어져요..
제발 도와주세요..ㅠㅠ
</p>
</div>
</div>




<p> 에 id값주고
스크립트 success 부분에서
$(#p태그아이디).html(data);
이렇게 하면 안들어 갈려나요..