var contact_id = 0 ;

/* MODAL */

// pre-submit callback
function showRequest_modal(formData, jqForm, options) {
    // formData is an array; here we use $.param to convert it to a string to display it
    // but the form plugin does this for you automatically when it submits the data
    var queryString = jQuery.param(formData);

    // jqForm is a jQuery object encapsulating the form element.  To access the
    // DOM element for the form do this:
    // var formElement = jqForm[0];

    if(jQuery('#task_modal').val() == "delete_entry"){
        jQuery('#deletebutton_modal').button('loading');
    }
    else jQuery('#savebutton_modal').button('loading');

    // here we could return false to prevent the form from being submitted;
    // returning anything other than false will allow the form submit to continue
    return true;
}

// post-submit callback
function showResponse_modal(response, statusText, xhr, $form)  {
    // for normal html responses, the first argument to the success callback
    // is the XMLHttpRequest object's responseText property

    // if the ajaxSubmit method was passed an Options Object with the dataType
    // property set to 'xml' then the first argument to the success callback
    // is the XMLHttpRequest object's responseXML property

    // if the ajaxSubmit method was passed an Options Object with the dataType
    // property set to 'json' then the first argument to the success callback
    // is the json data object returned by the server

    vm.current_contact.update(response.content);
    render_reload_item(vm.current_contact);

    jQuery('#savebutton_modal').button('reset');
    jQuery('#deletebutton_modal').button('reset');
    jQuery('#closebutton_modal').click();

    //notify if there are messages
    notify_messages(response.notifications);

}
