gpt4 book ai didi

javascript - 在没有输入字段的情况下通过 POST 方法传递数据

转载 作者:行者123 更新时间:2023-12-02 16:56:49 27 4
gpt4 key购买 nike

enter image description here

我有一项服务,我在没有输入字段的情况下传递了数据。我有一个 JSON 响应,并且已从 JSON 响应中获取所需的数据,并使用方法 POST 将其传递给 API 调用。

点击“预订”按钮(如上传的图片所示),我已发送doctorId时间

形成输入字段,我知道,但没有输入标签我不知道。

这是我的代码。

服务.js

newbooking : function(data) {
var param = angular.toJson(data, false);
return $http({
method: 'POST',
url: server + '/Bookings',
data: param,
headers: {'Content-Type' : 'application/json'},
});
},

HTML 代码:

<ion-list id = "background"  ng-controller = "CliniclistCtrl">
<div id = "background" ng-repeat="available in appointment.Appointments" >
<ion-item class="item-stable item item-avatar" ng-click = "select(available.DoctorId);">
<img ng-src = "img/1.png"/>
<!-- &nbsp; -->
{{available.Name}}
&nbsp;
<p>{{available.Speciality}}</p>
</ion-item >
<ion-item class="item-accordion"
ng-repeat="item in available.Appointments"
ng-show="isSelected(available.DoctorId)">
<a>{{item.AppointmentTime}} <br/> Available: {{item.Available}} </br>Doctor Id: {{available.DoctorId}}</a>
<button style = "float : right; width:100px; font-size: 15px; border-radius: 8px; border-color: #66cc33;" class="button button-small button-balanced" ng-click = "book();">Book</button>
</ion-item>
</div>
</ion-list>

请告诉我该怎么做。

最佳答案

将参数传递到您的预订函数中,如下所示:

<button ng-click="book(item.AppointmentTime, avalaible.DoctorID)">Book</button>

在您的 Controller 中,您将执行以下操作:

$scope.book = function(time,id){
//call your service here.
newbooking(time,id);
}

关于javascript - 在没有输入字段的情况下通过 POST 方法传递数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26118551/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com