问题描述
enter image description here我正在研究 PHP laravel 框架。我需要在单击提交按钮时提示显示条款和条件的甜蜜警报。我不知道使用甜蜜警报。我只是使用了一些模板并编写了以下代码。它不起作用。谁能帮我这个
@extends('layouts.app')
@section('maincontent')
<div class="login-form">
<div class="container">
<div class="row ">
<div class="innerpage-Box">
@include('layouts.errors')
<div class="innerpage-Box-header text-center">
<h3></b>Products to Buy</h3>
</div>
<div class="register-Box-body">
<!-- <p class="login-Box-msg">REGISTRATION FORM</p> -->
<form role="form" id="myForm" action="/chemOrderSave" method="Post" class="bidDetailSave">
@csrf
<input type="hidden" name="product_id" value="{{$pro[0]->id}}">
<div class="row">
<div class="col-md-6">
<label> <b> Price: </b>
{{$pro[0]->price * 1.02}}
</label> </br>
<div class="form-group">
<label for="buyer_quantity"><b> Quantity </b> <star>*</star></label>
<input type="text" class="form-control" id="buyer_quantity" name="buyer_quantity" placeholder="Enter the Quantity" value="{{$pro[0]->quantity}}">
</div>
<div class="form-group">
<label for="chem_shipping">Shipping</label>
<select name="chem_shipping" class="form-control" required>
<option value="">Please select one of the following Shipping Addresses</option>
@foreach($us as $uss)
<option value="{{$uss->id}}" > {{$uss->address}} {{$uss->city}} {{$uss->state}} {{$uss->zipcode}} {{$uss->country}} </option>
@endforeach
</select>
</div>
</div>
<button type="submit" class="btn btn-success updateOrder" ><i class="fa fa-save"></i> Submit</button>
<a href="/chemClearDashboard/Buyer/{{$pro[0]->user_id}}" class="btn btn-danger" style="font-size: 1rem !important;"><i class="fa fa-close"></i> Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
在custom.js中我写了以下代码
$('.container').on('click','.updateOrder',function() {
//e.preventDefault();
var id = $(this).attr('id');
var title = "Are you sure,By Clicking accept you agree to Farmerce's user agreement and are agreeing to follow through on this transaction !";
swal({
title: title,type:'warning',showConfirmButton: true,showCancelButton: true,allowOutsideClick: false,confirmButtonText:'Confirm',}).then((result) => {
if (result.value) {
$.ajax({
type: 'post',url: '/chemBuyer',data: {'_token': $('input[name=_token]').val(),'id':id},success: function(data) {
if(data == 'success'){
var title= 'Successfully Order Placed!!!';
var type='success';
}else{
var title= 'Some thing went wrong with the '+name+' !!!';
var type='error';
}
swal({
title: title,type:type,confirmButtonText:'OK',}).then(function(){
window.location.reload();
});
}
});
}
})
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)