본문 바로가기 메뉴 바로가기

Joonpyo-Hong

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Joonpyo-Hong

  • 분류 전체보기 (39)
    • [React] (3)
    • [Spring] (4)
    • [Java] (1)
    • [JS] (15)
    • [Ajax] (3)
    • [MyBatis] (1)
    • [Tomcat] (1)
    • [CSS] (3)
    • [C#] (1)
    • [MSSQL] (2)
    • [중국] (4)
  • 방명록

ajax (2)
[Ajax] Ajax - Controller 값(parameter) 넘기기 받기

Ajax에서 Controller로 값(parameter) 넘기기 $.ajax({ url : "test.action", type : 'post', data : { name : "이름", age : "20", gender : "man" }, success : function(data) { }, error : function() { alert("error"); } }); 방법 1. @RequestMapping(value = "/test.action", method = { RequestMethod.POST }) public void test(@RequestParam("name") String name,@RequestParam("age") String age,@RequestParam( "gender") Strin..

[Ajax] 2021. 7. 19. 14:43
[Ajax] Ajax에서 값 return하기

function test() { var test_val; $.ajax({ url: "/test/ajax_test.action", dataType: "json", type: "post", async: false, //async 속성을 false 선언 ajax를 비동기가 아닌 동기식으로 처리하게 한다. data: { param : "param", // POST형식으로 url과 함께 보낼 값 }, success: function(data) { test_val = data; }, error: function(e) { alert("오류"); } }); return test_val; } //확인 alert(test()); Ajax는 비동기 방식이여서 undefined 가 return 되기 때문에 async : fa..

[Ajax] 2021. 7. 16. 16:17
이전 1 다음
이전 다음
반응형

Blog is powered by joonpyo-hong / Designed by joonpyo-hong

티스토리툴바