let choiceContext = [];
let nameList = [];
const data = {
    resource_id: '9329755c-6406-4894-88b7-e7b04ccdfecc',
    limit: 10,
};
$.ajax({
    url: 'https://www.data.brisbane.qld.gov.au/data/api/3/action/datastore_search',
    data: data,
    dataType: 'jsonp',
    cache: true,
    success:
        function sendIN(data){
            $.each(data.result.records, function(recordKey, recordValue) {
                //some code about addding data to choiceContext
                return choiceContext; //assume a result
            });
        }
});
const answer = sendIN();
Hi, in these codes above, there is a function which called sendIN, I just want to use the result of it in out of ajax...but it dose not work.
However, I have tried to use document.Cookie:
let choiceContext = [];
let nameList = [];
const data = {
    resource_id: '9329755c-6406-4894-88b7-e7b04ccdfecc',
    limit: 10,
};
$.ajax({
    url: 'https://www.data.brisbane.qld.gov.au/data/api/3/action/datastore_search',
    data: data,
    dataType: 'jsonp',
    cache: true,
    success:
        function sendIN(data){
            $.each(data.result.records, function(recordKey, recordValue) {
                //some code about addding data to choiceContext
                document.Cookie = choiceContext;
            });
        }
});
const answer = document.Cookie;
It works, but it cannot store enough data, so I need to find another way to achieve this.
Really thanks!
 
    