当我点击我的模型时,这是我的模型
<div class="modal fade" id="checkoutModal" tabindex="-1" role="dialog" aria-labelledby="checkoutModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="checkoutModalLabel">Shipping Address</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<div class="row">
<form action="thankYou.php" method="post" id="payment-form">
此标记高出每个问题,并且传递了背景颜色调用
<p class="bg-danger" id="payment-errors"></p>
这是问题
步骤1 div打开我点击下一步然后不在第2步中的下一个div就像药丸类型
<div id="step1" style="display: block;">
<div class="from-group col-md-6">
<label for="full_name">Full Name:</label>
<input class="form-control" id="full_name" name="full_name" type="text">
</div>
<div class="from-group col-md-6">
<label for="email">Email :</label>
<input class="form-control" id="email" name="email" type="email">
</div>
<div class="from-group col-md-6">
<label for="street">Street Address:</label>
<input class="form-control" id="street" name="street" type="text">
</div>
<div class="from-group col-md-6">
<label for="street2">Street Address 2:</label>
<input class="form-control" id="street2" name="street2" type="text">
</div>
<div class="from-group col-md-6">
<label for="city">City :</label>
<input class="form-control" id="city" name="city" type="text">
</div>
<div class="from-group col-md-6">
<label for="state">State :</label>
<input class="form-control" id="state" name="state" type="text">
</div>
<div class="from-group col-md-6">
<label for="zip_code">Zip Code:</label>
<input class="form-control" id="zip_code" name="zip_code" type="text">
</div>
<div class="from-group col-md-6">
<label for="country">Country:</label>
<input class="form-control" id="country" name="country" type="text">
</div>
</div>
当点击下一步时,这个div没有打开一些错误并且出现此错误
<div id="step2" style="display: none;"></div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="check_address();">Next >></button>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
这是我认为可以帮助你的按钮功能
<script>
function check_address(){
var data = {
'full_name' : jQuery('#full_name').val(),
'email' : jQuery('#email').val(),
'street' : jQuery('#street').val(),
'street2' : jQuery('#street2').val(),
'city' : jQuery('#city').val(),
'state' : jQuery('#state').val(),
'zip_code' : jQuery('#zip_code').val(),
'country' : jQuery('#country').val()
};
jQuery.ajax({
url : '/ecommerce/admin/parsers/check_address.php',
method : 'POST',
data : data,
success : function(data){
if(data != 'passed'){
jQuery('#payment-errors').html(data);
}
if(data == 'passed'){
alert('Passed!');
}
},
error : function (){alert("Something Went Wrong");}
});
}
</script>
这是另一个页面链接,这是java脚本文件的检查文件
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/ecommerce/connection/init.php';
$name = sanitize($_POST['full_name']);
$email = sanitize($_POST['email']);
$street = sanitize($_POST['street']);
$street2 = sanitize($_POST['street2']);
$city = sanitize($_POST['city']);
$state = sanitize($_POST['state']);
$zip_code = sanitize($_POST['zip_code']);
$country = sanitize($_POST['country']);
$errors = array();
$required = array (
'full_name' => 'Full Name',
'email' => 'Email',
'street' => 'Street Address',
'city' => 'City',
'state' => 'State',
'zip_code' => 'Zip Code',
'country' => 'Country',
);
//All field is Required
foreach($required as $f => $d){
if(empty($_POST[$f]) || $_POST[$f] == ''){
$errors[] = $d.' is required.';
}
}
// Valid Email Address
if(!filter_var($email,FILTER_VALIDATE_EMAIL)){
$errors[] = 'Please Enter a valid Email.';
}
if(!empty($errors)){
echo display_errors($errors);
}else{
echo 'passed';
}