본문 바로가기

Study/Javascript

[JQuery][ajax] 기본 post 요청 구조

$.ajax_text = function(){
    $.ajax({
        type: "POST",
        url : 'http://......',
        data: "pg=1&pageSize=10",
/*
        data: {
                "a": "a_data",
                "b": "b_data"
        },
*/
        dataType: 'json', //dataType: 'html',
        success: function (data)
        {
            alert(data);
            console.log(data);
        },
        error: function (e)
        {
            alert("err : \n\n" + e.responseText);
        }
    });
};