在按钮单击中添加ajax事件 [英] adding ajax event in button click

查看:872
本文介绍了在按钮单击中添加ajax事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在按钮单击中添加ajax事件,以便我可以执行某些任务,例如复选框选择更改事件而不重置其他控件值...?

解决方案

假设您的标记为



 <   input     type   =   text    id   =  FirstTextBox    /  >  
< 输入 type = 按钮 id = TransferButton value < span class =code-keyword> = 点击我! / >





Javascropt通过JQuery进行ajax调用如下





  var  gatherValue = 


#FirstTextBox )。val();


document )。ready(功能(){

how to add ajax event in button click so i can perform some task such as check box selection change event without resetting other controls values...?

解决方案

suppose your markup goes as

<input type="text" id="FirstTextBox" />
<input type="button" id="TransferButton" value="Click Me!" />



Javascropt to do an ajax call by JQuery is as follows


var collectedValue=


("#FirstTextBox").val();


(document).ready(function(){


这篇关于在按钮单击中添加ajax事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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