'2017/01/26'에 해당되는 글 2건

  1. 2017.01.26 ajax로 article 화면 수정
  2. 2017.01.26 jQuery ajax GET 방식 php
ajax2017. 1. 26. 02:27


<script type="text/javascript">
$(document).ready(function(){
	// var result;
	$(".ajax_li_a").each(function(){
		// result = '[]' +$(this).html();
		
		$(this).click(function(){
			var varAttr = $(".ajax_li_a").attr("x_href");
			$.ajax({	
				type: 'GET',
				url: varAttr,
				dataType : 'text',
				error : function() {
				  alert('Fail!!');
				},
				success: function(data) {
					$('article').html(data);
				}
			});
		})			
	});
});
</script>




  <?php
      while( $row = mysqli_fetch_assoc($result) ){
	echo "<li><a class='ajax_li_a' x_href='part/article.php?".$sql_id."=".$G_row_id."&bgnitem=".$Gget_begin_item."'>".htmlspecialchars($row['title'])."</a></li>"."\n";
      }
    ?>










Posted by 코드버무려
서버사이드2017. 1. 26. 01:40


[index.php] 파일

<script src="https://code.jquery.com/jquery-3.1.1.js" integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA=" crossorigin="anonymous"></script> <!-- <script src="https://code.jquery.com/jquery-1.10.2.js"></script> -->



<script type="text/javascript"> $(function(){ $("#tstButton").click(function(){ $.ajax({ type: 'GET', url: 'part/nav_test.php?test=[-U U-]', dataType : 'text', error : function() { alert('Fail!!'); }, success: function(data) { $('#tstResult').html(data); } }); }) }) </script>


[Click me]버튼을 누르면 전체 화면을 불러오지 않고 대괄호 내부 값을 보여준다.

<input type="button" id="tstButton" value="Click me" /><br> <H3 id="tstResult">[*******]</H3>





[nav_test.php] 파일

<?php echo $_GET["test"]."<br>"; ?>





'서버사이드' 카테고리의 다른 글

appbrd_T170209Th1136zp.cpy-pwed  (0) 2017.02.09
styles.css 갱신 강제로  (0) 2017.01.15
Welcome{ *Login, *Register, fb}  (0) 2016.10.15
오리엔트db 설치 server\jvm.dll 에러  (0) 2015.09.23
lower_case_table_names  (0) 2014.12.06
Posted by 코드버무려