src/extensions/default/HealthData/HealthDataManager.js
function sendHealthDataToServer() {
        var result = new $.Deferred();

        getHealthData().done(function (healthData) {

            var url = brackets.config.healthDataServerURL,
                data = JSON.stringify(healthData);

            $.ajax({
                url: url,
                type: "POST",
                data: data,
                dataType: "text",
                contentType: "text/plain"
            })
                .done(function () {
                    result.resolve();
                })
                .fail(function (jqXHR, status, errorThrown) {
                    console.error("Error in sending Health Data. Response : " + jqXHR.responseText + ". Status : " + status + ". Error : " + errorThrown);
                    result.reject();
                });
        })
            .fail(function () {
                result.reject();
            });

        return result.promise();
    }
function sendHealthDataToServer() {
        var result = new $.Deferred();

        getHealthData().done(function (healthData) {

            var url = brackets.config.healthDataServerURL,
                data = JSON.stringify(healthData);

            $.ajax({
                url: url,
                type: "POST",
                data: data,
                dataType: "text",
                contentType: "text/plain"
            })
                .done(function () {
                    result.resolve();
                })
                .fail(function (jqXHR, status, errorThrown) {
                    console.error("Error in sending Health Data. Response : " + jqXHR.responseText + ". Status : " + status + ". Error : " + errorThrown);
                    result.reject();
                });
        })
            .fail(function () {
                result.reject();
            });

        return result.promise();
    }
function sendHealthDataToServer ( ) { var result = new $ . Deferred ( ) ; getHealthData ( ) . done ( function ( healthData ) { var url = brackets . config . healthDataServerURL , data = JSON . stringify ( healthData ) ; $ . ajax ( { url : url , type : "POST" , data : data , dataType : "text" , contentType : "text/plain" } ) . done ( function ( ) { result . resolve ( ) ; } ) . fail ( function ( jqXHR , status , errorThrown ) { console . error ( "Error in sending Health Data. Response : " + jqXHR . responseText + ". Status : " + status + ". Error : " + errorThrown ) ; result . reject ( ) ; } ) ; } ) . fail ( function ( ) { result . reject ( ) ; } ) ; return result . promise ( ) ; }
Send data to the server
Send data to the server