'프로그래밍 > javascript' 카테고리의 다른 글
callback 간단예제 (0) | 2018.03.06 |
---|---|
클로저 간단예제 (0) | 2018.03.06 |
highcharts 예제 (0) | 2018.03.05 |
jQuery ajax (0) | 2018.02.28 |
jQuery 정리 (0) | 2018.02.28 |
callback 간단예제 (0) | 2018.03.06 |
---|---|
클로저 간단예제 (0) | 2018.03.06 |
highcharts 예제 (0) | 2018.03.05 |
jQuery ajax (0) | 2018.02.28 |
jQuery 정리 (0) | 2018.02.28 |
샘플소스 : http://www.highcharts.com/demo/line-basic
callback 간단예제 (0) | 2018.03.06 |
---|---|
클로저 간단예제 (0) | 2018.03.06 |
js 캡쳐 (0) | 2018.03.05 |
jQuery ajax (0) | 2018.02.28 |
jQuery 정리 (0) | 2018.02.28 |
jQuery.ajax({
type : "GET" //"POST", "GET" // 1.9.0 이상부턴 method 사용 ("POST", "GET", "PUT", "DELETE")
//,target : "#div_id" // 결과값 해당 div에 찍음 ( 테스트안해봄 )
, async : true // 비동기:true, 동기:false ( jsonp타입 등 일부 지원 안함 )
, url : "http://test.com/test" //Request URL
, dataType : "html" //전송받을 데이터의 타입
//"xml", "html", "script", "json" 등 지정 가능
//미지정시 자동 판단
, timeout : 30000 //제한시간 지정
, cache : false //true, false
, data : "" //$("#inputForm").serialize() //서버에 보낼 파라메터
//form에 serialize() 실행시 a=b&c=d 형태로 생성되며 한글은 UTF-8 방식으로 인코딩
//"a=b&c=d" 문자열로 직접 입력 가능
//{a:b, c:d} json 형식 입력 가능
, contentType: "application/x-www-form-urlencoded; charset=UTF-8"
, error : function(request, status, error) {
//통신 에러 발생시 처리
}
, success : function(response, status, request) {
//통신 성공시 처리
}
, beforeSend: function() {
//통신을 시작할때 처리
}
, complete: function() {
//통신이 완료된 후 처리
}
});
// async를 지원하지않을 땐 마지막에 .done 함수를 붙여서 사용하는 방법도..
jQuery.ajax({
type : "GET" //"POST", "GET" // 1.9.0 이상부턴 method 사용 ("POST", "GET", "PUT", "DELETE")
, url : "http://test.com/test" //Request URL
, dataType : "jsonp"
.
.
.
, success : function(response, status, request) {
//통신 성공시 처리
jQuery('#multi').append(response);
}
}).done(function(res) {
return 2;
});
callback 간단예제 (0) | 2018.03.06 |
---|---|
클로저 간단예제 (0) | 2018.03.06 |
js 캡쳐 (0) | 2018.03.05 |
highcharts 예제 (0) | 2018.03.05 |
jQuery 정리 (0) | 2018.02.28 |
## Jquery 에서 폼 배열에 접근하기 위해서 eq(index) 함수를 사용하면 된다.
예)
<form id="frm" name="frm">
<input type="text" name="BOX_PIRCE" value="100" />
<input type="text" name="BOX_PIRCE" value="200" />
<input type="text" name="BOX_PIRCE" value="300" />
<input type="text" name="BOX_PIRCE" value="400" />
</form>
var boxPrice = $("#frm input[name='BOX_PRICE']").eq(2).val();
## JQUERY number_format 사용방법
<script language="javascript" src="/js/jquery.number.min.js"></script>
<script>
var a = 123456;
$.number(a);
</script>
## Jquery 폼안의 name으로 접근하기
alert( $("#frm_add").find("[name=title]").val() ); //frm_add 폼안에 네임이 title인 값
jQuery("#frm>input[name=mode]").val( mode );
## jQuery selectBox
get $("select[name=selectname] > option:selected").val();
set $("select[name=selectname] > option:selectvalue").attr("selected", true);
jQuery("#selectBox").empty(); // 옵션전체삭제
jQuery("#selectBox").prepend("<option value='val'>text</option>"); // 맨 앞에 옵션추가
jQuery("#selectBox").append("<option value='val'>text</option>"); // 맨 뒤에 옵션추가
jQuery("#selectBox option:eq(2)").attr("selected", "selected"); // 지정된 index값으로 select 하기
jQuery("#selectBox").val("Someoranges").attr("selected", "selected"); // text 값으로 select 하기
jQuery("#selectBox").val("2"); // value값으로 select 하기
jQuery(document).ready(function() {
// onchange
jQuery("#selectBox").change(function(){
// change 발생 시 실행
});
});
## jQuery Loop
var res = json.data;
jQuery.each(res, function(key, val ) {
console.log("key=>"+key+" value=>"+val);
});
## jQuery Cookie
// 쿠키 생성
function setCookie(cName, cValue, cDay){
$.cookie(cName, cValue, { expires: cDay, path: '/', domain: document.domain, secure: false });
}
// 쿠키 가져오기
function getCookie(cName) {
return $.cookie(cName);
}
callback 간단예제 (0) | 2018.03.06 |
---|---|
클로저 간단예제 (0) | 2018.03.06 |
js 캡쳐 (0) | 2018.03.05 |
highcharts 예제 (0) | 2018.03.05 |
jQuery ajax (0) | 2018.02.28 |