https://wouldyou.tistory.com/36

http://craftpip.github.io/jquery-confirm/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function fnInput() {
    const promise = new Promise(function (resolve, reject) {
        //fnLoadingOpen(); // 로딩 시작
 
        // 로딩 이미지가 활성화 된 상태에서 실행하기 위해 지연시간을 둠
        setTimeout(function () {
            resolve();
        }, 100);
    });
 
    promise.then(function () {
        // 처리
        //....................
 
        //return 리턴값; // 리턴값 있을 경우 사용
   }).then(function(value) { // 이전단계에서 처리 후 리턴값을 보냈으면 받아서 처리
        //fnLoadingClose(); // 로딩 종료
    });
}
 
/****************************************/
IE에서 Promise가 지원 안되기 때문에 
 
html head에 script 추가
 
 
    if (typeof Promise !== "function") {
        document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.5/bluebird.min.js"><\/script>');
    }
 
 
추가
cs

JAVASCRIPT


test.aspx


········

var arrParams = [];

     arrParams[0] = '0';

     arrParams[1] = 'test';

var jsonData = JSON.stringify({ pArrParams: arrParams }); // ascx와 변수명이 동일이해 한다


$.ajax({

type: 'POST',

url: 'test.ascx/GetTestParam',

data: jsonData,

//async: false, // 동기(true)/비동기(false)

//contentType: 'application/json; charset=euc-kr',

dataType: 'json', // dataType is json format

success: function (res) {

var result = res.d;

//console.log(result);

},

error: function (res) {

alert('오류가 발생했습니다.\n\nstatus : ' + res.status + '\nstatusText : ' + res.statusText);

//console.log(res.responseText);

}

});

········



.NET


test.ascx


········

/// <summary>

/// Setting의 요약 설명입니다.

/// </summary>

[WebService(Namespace = "http://tempuri.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[ScriptService]

········

[WebMethod]

public int GetTestParam(List<string> pArrParams)

{

object[] arrParam = new object[2];


arrParam[0] = pArrParams[1];

arrParam[1] = pArrParams[2];


// 파라미터를 받아서 처리

········

}

········

+ Recent posts