I
I
Ivan Kashmir2015-08-10 15:47:04
JavaScript
Ivan Kashmir, 2015-08-10 15:47:04

How to return json in ajax request with "async: true"?

How to return json in ajax request with "async: true" ?
Example with "async: false":

$.getText = function(text){
        var result;
        $.ajax({
            url : 'lang.json',
            async: false,
            success:function(data) {
                result = data[text];
            }
        });
        return result
    };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kashmir, 2015-08-10
@Kashmir2606

OK I understood. Thanks for the answer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question