[英]JQuery Requests overlaps in google appengine
Hi I have dynamically added functionality like adding a customer to a customer list appear in mouse over event . 嗨,我已经动态添加了一些功能,例如在鼠标悬停事件中显示将客户添加到客户列表中。 it has add new list item and once the user clicks it a textbox appears and once the user enters valid content it adds the newly entered item to the list saves it and displays the newly added thing with a tick. 它具有添加新的列表项,并且一旦用户单击它,就会出现一个文本框,一旦用户输入有效的内容,它就会将新输入的项添加到列表中以保存它并显示带有勾号的新添加的东西。 and when a user click on already ticked item it deletes from the list . 当用户单击已经打勾的项目时,它将从列表中删除。
when i implement this functionality locally we can add a customer to many lists from one try . 当我在本地实现此功能时,我们可以一次尝试将客户添加到许多列表中。 but when i upload the application and try it it saves a new customer group but when i trying to add more from a one shot it only added the last one. 但是,当我上载该应用程序并进行尝试时,它会保存一个新的客户组,但是当我尝试从一个镜头中添加更多内容时,它只会添加最后一个。 the previously added customers key is going with the request . 先前添加的客户密钥正在处理请求。 if the customer s key already available it deletes the customer from the group which already being added . 如果客户的密钥已经可用,它将从已添加的组中删除客户。 this works more like facebook's friend list which you can find in friends page we can add friends to different lists. 这更像是Facebook的朋友列表,您可以在朋友页面中找到我们可以将朋友添加到不同列表的方法。
is there a way to synchronize jquery ajax requests . 有没有一种方法来同步jquery ajax请求。 can any one help? 有人可以帮忙吗?
$('.newcustomerlist').live("keypress",function (event) {
var element_id = $('.custitem').attr('id');
var customer_key = null;
var url_key = null;
if (element_id != null) {
customer_key = element_id.split('#')[0]
url_key = element_id.split('#')[1]
} else {
url_key = $(this).attr("id");
}
if(event.which == '13') {
var cust_list_name = $(this).val().trim();
var val = (/^[a-zA-Z ]*[-a-zA-Z0-9_ ]+$/).test(cust_list_name);
if(val){
$.ajax({
type : "GET",
url : "/addcustomerfromhere/",
data : "cust_list_name=" + cust_list_name,
success : function (msg) {
new_customer_key = msg.customer_key ;
$.ajax({
type : "GET",
url : "/addcustomertolist/",
data : "url_key=" + url_key + "&customer_key =" + new_customer_key ,
success : function (data) {
$("ul.custlist").prepend("<li id="+ new_customer_key + "#"+ url_key + " class='custitem addedtocust'><span>" + msg.cust_list_name + "</span></li>");
$(".title").show();
},
error : function (XMLHttpRequest, textStatus, errorThrown) {
$.notify({message: 'Apologies. Our servers are busy at this moment. Please try again later.', type: 'error'});
}
});
},
error : function (XMLHttpRequest, textStatus, errorThrown) {
$.notify({message: 'Apologies. Our servers are busy at this moment. Please try again later.', type: 'error'});
}
});
$(".addnew").show()
$(".newtext").hide()
} else {
}
}
});
您可以将其添加到ajax选项:
async:false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.