Syntax
The parameters specifies one or more name/value pairs for the AJAX request.
Possible names/values in the table below:
Sample
var array;
$.ajax({
url : "http://localhost:8088/abc.jsp", // 로컬 url
type : "POST", // get,post 방식 중 선택
dataType : 'json', // json 방식으로 전송
data : { "lang" : "ko" }, // (생략가능) 다국어 처리 (ko:한국어(default),en:영어,ja:일본어,zh:중국어)
success : function(data) { // 연동 성공시 데이터 반환 함수
array = data["array"];
$('#getTitle').html(array[0].titleName); // 타이틀 출력
$('#getCount').html(""+array[0].count); // 건 수 출력
$('#getUrl').attr("href",array[0].url); // 건 수 클릭시 POWIS 업무목록 화면으로 이동 URL 세팅
}
});
수신측 :
{
"array" :
[
{
"titleName" : "타이틀명",
"count": ["5"],
"url": ["http://www.naver.com/"]
}
]
}
Name | Value/Description |
---|---|
async | A Boolean value indicating whether the request should be handled asynchronous or not. Default is true |
beforeSend(xhr) | A function to run before the request is sent |
cache | A Boolean value indicating whether the browser should cache the requested pages. Default is true |
complete(xhr,status) | A function to run when the request is finished (after success and error functions). |
contentType | The content type used when sending data to the server. Default is: "application/x-www-form-urlencoded" |
context | Specifies the "this" value for all AJAX related callback functions |
data | Specifies data to be sent to the server |
dataFilter(data,type) | A function used to handle the raw response data of the XMLHttpRequest |
dataType | The data type expected of the server response. |
error(xhr,status,error) | A function to run if the request fails. |
global | A Boolean value specifying whether or not to trigger global AJAX event handles for the request. Default is true |
ifModified | A Boolean value specifying whether a request is only successful if the response has changed since the last request. Default is: false. |
jsonp | A string overriding the callback function in a jsonp request |
jsonpCallback | Specifies a name for the callback function in a jsonp request |
password | Specifies a password to be used in an HTTP access authentication request. |
processData | A Boolean value specifying whether or not data sent with the request should be transformed into a query string. Default is true |
scriptCharset | Specifies the charset for the request |
success(result,status,xhr) | A function to be run when the request succeeds |
timeout | The local timeout (in milliseconds) for the request |
traditional | A Boolean value specifying whether or not to use the traditional style of param serialization |
type | Specifies the type of request. (GET or POST) |
url | Specifies the URL to send the request to. Default is the current page |
username | Specifies a username to be used in an HTTP access authentication request |
xhr | A function used for creating the XMLHttpRequest object |
'Dev. 웹' 카테고리의 다른 글
Velocity 사용하기 (0) | 2015.04.29 |
---|---|
[Custom Tag] custom tag 작성 중 SimpleTagSupport 에서의 세션 가져오기 (0) | 2014.10.28 |
오류 해결] IE에서 WrongDocumentError 발생 원인 및 해결 방법 (3) | 2014.10.24 |
JSTL (JSP Standard Tag Library) 시작하기 - 이해 및 실습 (0) | 2014.10.14 |
JavaScript and HTML DOM(Document Object Model) - 웹의 객체 구조화 (0) | 2012.09.11 |