<script>
$(document).ready(function(){
$('#btn_submit').click(function(){
// собираем данные с формы
var user_id = $('#user_id').val();
var tarif = $('#tarif').val();
var user_name = $('#user_name').val();
var user_email = $('#user_email').val();
var company_name = $('#company_name').val();
var company_adress = $('#company_adress').val();
var company_adress2 = $('#company_adress2').val();
var adress = $('#adress').val();
var date = $('#date').val();
var time = $('#time').val();
var transp = $('#transp').val();
var comment = $('#comment').val();
// отправляем данные
$.ajax({
url: "/action_order.php", // куда отправляем
type: "post", // метод передачи
dataType: "json", // тип передачи данных
data: { // что отправляем
"user_id": user_id,
"tarif": tarif,
"user_name": user_name,
"user_email": user_email,
"company_name": company_name,
"company_adress": company_adress,
"company_adress2": company_adress2,
"adress": adress,
"date": date,
"time": time,
"transp": transp,
"comment": comment
},
// после получения ответа сервера
success: function(data){
$('.messages').html(data.result); // выводим ответ сервер
$('#myTab a[href="#profile"]').tab('show'); // Select tab by name
alert('ok');
}
});
});
});
</script>
<div class="messages"></div>
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Book a courier</a></li>
<li><a href="#profile" data-toggle="tab">Orders </a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
<div class="registeruser2">
<div class="left">
<br/>
<input type="hidden" id="user_id" style="width: 350px;" value="<?php echo $client_id; ?>" />
<input type="hidden" id="tarif" style="width: 350px;" value="<?php echo $tarif; ?>" />
<label>Your name*</label>
<input type="text" id="user_name" style="width: 350px;" value="<?php echo $user->name; ?>" /><br/>
<label>Your email*</label>
<input type="text" id="user_email" style="width: 350px;" value="<?php echo $user->email; ?>" /><br/>
<label>Company name*</label>
<input type="text" id="company_name" style="width: 350px;" value="<?php echo $user->company_name; ?>" /><br/>
<label>Vehicle*</label>
<select name="transp" id="transp">
<option value="Car">Car</option>
<option value="Bike">Bike</option>
</select>
<label>Reference *</label>
<textarea name="comment" id="comment" cols="30" rows="10"></textarea>
<br/>
</div>
<div class="right">
<br>
<label>START ADDRESS*</label>
<input type="text" id="adress" style="width: 350px;" value="" /><br/>
<label>DESTINATION ADDRESS*</label>
<input type="text" id="company_adress" style="width: 350px;" /><br/>
<label>
THIS IS A GROUP DELIVERY <input type="checkbox" name="multi_note" value="1" onclick="showMe(this)">
</label>
<div id="div1" style="display:block; display:none;">
<label>Specify additional shipping address with the character "-"</label>
<textarea id="company_adress2" cols="30" rows="10"></textarea>
</div>
<br>
<div class="left_in">
<label>Date*</label>
<input type="date" id="date" style="width: 200px;" value="<?php echo date("Y-m-d");?>" />
<p>Format: 22 03 2015</p>
</div>
<div class="right_in">
<label>Time*</label>
<input type="text" id="time" style="width: 100px;" value="<?php echo date("H:i", strtotime("+1 hours"));?>" />
<p>Format: 22:45 </p>
<br/>
</div>
</div>
<input type="button" value="Send" class="btn" id="btn_submit" />
</div>
</div>
<div class="tab-pane fade" id="profile">...</div>