在 .getjson jquery 调用期间禁用选择下拉菜单并在完成后重新启用
我有以下代码,在单击选择框后我获取 JSON。有时需要很长时间,并且用户在服务器端处理期间再次单击下拉列表。
无论如何,是否可以在服务器端调用期间禁用下拉列表,并在处理完成后重新启用它。
这是我的代码
<script type="text/javascript">
$(document).ready(function() {
$('#userDropdown').change(function() {
if (this.selectedIndex != 0) {
var URL = "/Users/GetUserJson/" + this.value;
$.getJSON(URL, function(data) {
var userID = data.UserId;
var userColor = data.UserColor;
. . . .
i have the following code where i getJSON after i click on a select box. Sometimes it takes a long time and the users are clicking on the dropdown again during the server side processing.
Is there anyway to disable the dropdown during the server side call and reenabled it after the processing is complete.
here is my code
<script type="text/javascript">
$(document).ready(function() {
$('#userDropdown').change(function() {
if (this.selectedIndex != 0) {
var URL = "/Users/GetUserJson/" + this.value;
$.getJSON(URL, function(data) {
var userID = data.UserId;
var userColor = data.UserColor;
. . . .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Nerdling 建议您隐藏选择,但我宁愿禁用它,就像您自己说的那样:
Nerdling suggested that you hide the select, but I'd rather just disable it, just like you said yourself: