按钮服务器端点击jquery ajax post后不能正常工作 [英] button server side click not working after jquery ajax post

查看:174
本文介绍了按钮服务器端点击jquery ajax post后不能正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的一个代码中有问题。



我有一个按钮,它有服务器端和客户端点击事件。



客户端点击我调用java脚本函数来验证一些数据,并调用jquery ajax post方法来检查数据库中的一些标志。以前这个jquery ajax方法不存在,一切正常,但是当我添加此方法时,我的服务器端按钮单击停止工作。可能是post方法的原因,但我不确定。可以请一些人帮我这里是我的代码。





hi all,
i have a problem in one of my code.

i have a button which have server side and client click event.

on client click i call a java script function to validate some data and also call jquery ajax post method to check some flag from the database. previously this jquery ajax method was not there and everything works fine but as i add this method my server side button click stop working. may be bacause of the post method but i am not sure. can some one please help me here is my code .


<asp:Button ID="btnSave"  runat="server" Text="Save" class="button" onclick="btnSave_Click" OnClientClick="Page_ClientValidate(); return CompareDate(); "  />





compareate()是我的javascript函数,还有一个函数里面的比较日期是jquery ajax函数。





comparedate () is my javascript function and also have one more function inside compare date which is jquery ajax function.

 function CompareDate() {
var flag =falsel
//some validation code
//(this will set the flag based on some condition)
//ajax post method 
//(here again some data is compared)
//based on the last value of flag it will return true or false. n
}





现在我的函数返回true但按钮的服务器端方法点击不起作用。



now my function return true but server side method of the button click not working.

推荐答案

return true;来自CompareDate()函数的值。这将让页面回发。
return true; value from CompareDate() function. This will let the page to post-back.


这篇关于按钮服务器端点击jquery ajax post后不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆