I have a function which is calling an ajax request to a webservice. 

the result of the ajax call is an object .

Furthemore i need the value of a sepcific attribute of that returned object which is the **responseJSON** when i'm clicking a button

how may i get It ?

**Here is my ajax function:**

```
checkBtnPostulate: function () {
            return $.ajax({
                method: 'POST',
                url: annonce.route.testpostulate,
                data: {msg}
                dataType: 'json',
                success: function (data) {
                    //console.log(data);
                    if (data == 1) {              
                        $("#postulate-btn").removeClass("btn-postuler");
                        $("#postulate-btn #postulerState").text("Retirer la candidature");

                    } else if (data == 0) {       
                        $("#postulate-btn").addClass("btn-postuler");
                        $("#postulate-btn #postulerState").text("Postuler");

                    } else if (data == 2) {        
                        $("#postulate-btn").hide();

                    }
                },
                error: function (data) {
                    console.log(data);
                }
            });

        },

```

**and here is the function of the click button where i'm using the retur of my previous function.**

```
postulate: function () {
            $('body').one().on('click', '#submitCandidature', function (e) {
                window.annonce.checkBtnPostulate();  //MY PREVIOUS FUNCTION CALL
                var response = window.annonce.checkBtnPostulate(); // the object returned

                if (response.responseJSON == 1) {  // i need to get here the value
                    var FormCandidature = $("#form-candidature");
                    var candidatureObject = serializeObject(FormCandidature);
                    candidatureObject["id_mission"] = id_annonce;
                    var candidatureObject = JSON.stringify(candidatureObject);
                    window.sendData.start(FormCandidature, candidatureObject, "#modal-postuler");

                        }
                    })
                }
            });
        },

```

[![enter image description here](https://i.stack.imgur.com/mfSmf.png)](https://i.stack.imgur.com/mfSmf.png)

**How may i got it on the simpliest way ???**