- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
var action = $(this).attr("action");
var id_taxi = $('#id_taxi').val();
var id_car = $('#id_car').val();
var car_number = $('#number-car').val();
var car_code = $('#number-car-code').val();
<....>
if ( action == "add" ){
var url = '/api/4/*****/service/taxi/addAvto';
var data_send={ 'id_taxi':id_taxi, 'car_number':car_number, 'model':model, 'color':color, 'licence_number': licence_number, 'id_type_car_body': id_type_car_body, 'type_car_comfort' : comfort, 'car_options' : option, 'isActive': is_active };
}else if ( action == "edit" ){
var url = '/api/4/****/service/taxi/updateAvto';
var data_send={ 'id_car': id_car, 'car_number':car_number, 'model':model, 'color':color, 'licence_number': licence_number,'id_type_car_body': id_type_car_body, 'type_car_comfort' : comfort, 'car_options' : option, 'isActive': is_active};
}
<...>
var request = $.ajax({
url: url,
type: "POST",
dataType: 'json',
data: data_send
});
Сабмитим формы.
И так на всем проекте, 3к строк JS кода, которые подобным образом описывают ВСЕ формы на проекте.
web service architecture, йобана