Sencha Ajax 호출

2024. 9. 1. 15:44Javascript/Sencha

 

Ext.Ajax.request({
    url: 'your-server-endpoint-url', // The URL to which the request is sent
    method: 'GET', // The HTTP method to use for the request, e.g., 'GET', 'POST'
    params: {
        key1: 'value1',
        key2: 'value2'
    },
    success: function(response, opts) {
        // This function is called when the request succeeds
        var responseText = response.responseText;
        console.log('Server response:', responseText);

        // Optionally, parse the response as JSON
        var jsonResponse = Ext.decode(responseText);
        console.log('Parsed JSON:', jsonResponse);
        
        // 항목 출력
        console.log(jsonResponse.name);
        console.log(jsonResponse.tel);
    },
    failure: function(response, opts) {
        // This function is called when the request fails
        console.log('server-side failure with status code ' + response.status);
    }
});

 

'Javascript > Sencha' 카테고리의 다른 글

Sencha Form combobox  (1) 2024.09.01
Sencha 'itemId' 다루기  (0) 2024.09.01
Sencha requires  (0) 2024.09.01
Sencha 팝업 호출  (0) 2024.09.01
Sencha panel에 click 이벤트 넣기  (0) 2024.08.31