这是我想要实现的流程:
JSON.stringify
请求数据中的对象"task"
键的值为空/假(即“”),请发送客户端的响应状态(例如{{1} })
res.sendStatus(403)
阻止(由下面的评论指示)无法运行客户端AJAX帖子(main.js):
if
服务器端发送的userToDo对象:
$.post("/add-tasks", userToDo);
示例字符串化JSON:
userToDo = {
task = string;
important = boolean;
urgent = boolean;
quadrant = int; // 1 - 4
}
服务器端JS(app.js) - 重要的片段由注释表示:
{"task":"","important":"true","urgent":"false","quadrant":"2"}
答案 0 :(得分:2)
试试这个:
.eqv RCR 0x0000
lw $t0,RCR($s0) # get control reg
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<form ng-app>
<select ng-model="has_child">
<option value="1">Yes</option>
<option value="2">No</option>
</select>
<input type="text" ng-model="childcount" ng-hide="has_child == 2"/>
<input type="text" ng-model="mailcount" ng-hide="has_child == 2"/>
<input type="text" ng-model="femailcount" ng-hide="has_child == 2"/>
</form>
&#13;