JQuery Ajax调用花费了很多时间 [英] JQuery Ajax call is taking much time
本文介绍了JQuery Ajax调用花费了很多时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
我使用Jquery跟随Javascript
Hi friends,
I have following Javascript using Jquery
<script>
var userData = JSON.parse(localStorage.userData);
$(document).ready(function () {
//HERE I AM CALLING THE BIND CONTROL ON RADIO AND DROPDOWN CHANGE
$('#ddlConvention,#rbtnWeek :radio').change(function () {
userData.UserSet = new Array();
userData.UserSet[0] = new Object({ week: $('#rbtnWeek :radio:checked').val(), conventionid: $('#ddlConvention').val() });
//alert(JSON.stringify(userData));
bindControls(userData);
});
bindControls(userData);
});
function bindControls(userData)
{
//HERE IS THE CODE THAT CALLS THE WEBAPI USING JQUERY AND BIND CONTROL USING THE RESULT
}
</script>
在上面的代码中,我试图实现
1。首先调用bindControls方法。
2.在单选按钮和下拉列表的每个更改事件中,获取数据并填充控件。
问题:
In the above code, I trying to achiving
1. bindControls method is called first.
2. On every change event of the radio button and dropdown, get the data and fill the controls.
Problem:
<br />
If I remove #ddlConvention from <br />
<br />
$('#ddlConvention,#rbtnWeek :radio').change(function () { ... }<br />
<br />
The code works fine, but when #ddlConvention is added the code takes longer time.<br />
<br />
我可以知道什么是问题??
它看起来很简单,但实在令我感到困惑。
提前致谢
May I know what is the problem??
It looks simple but it is really confusing me.
Thanks in advance
推荐答案
(document).ready(function(){
// HE我正在呼吁对无线电和掉电更改进行绑定控制
(document).ready(function () { //HERE I AM CALLING THE BIND CONTROL ON RADIO AND DROPDOWN CHANGE
('#ddlConvention,#rbtnWeek:radio')。change(function(){
userData .UserSet = new Array();
userData.UserSet [0] = new Object({week:
('#ddlConvention,#rbtnWeek :radio').change(function () { userData.UserSet = new Array(); userData.UserSet[0] = new Object({ week:
('#rbtnWeek:radio:checked')。val(),conventionid:
('#rbtnWeek :radio:checked').val(), conventionid:
这篇关于JQuery Ajax调用花费了很多时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文