我可以使这个调用方法有效吗? [英] can I make this call method works?
问题描述
我有一个名为B1的按钮,它应该在点击时调用 ShowCurrent()
函数。当我使用按钮<$时,该功能正常工作c $ c> onclick 属性但是当我尝试在这里使用jquery这样的时候,没有任何反应。
混乱的调用方法?< pre lang =xml> < script >
$(document).ready(function(){
$(#B1)。click(function(){
ShowCurrent();
} );
});
< / script >
功能
< script >
function ShowCurrent(){
$ .ajax ({
类型:发布,
url:WebForm3.aspx / GetData,
数据:'{s:'+ $(#<% = TextBox1.ClientID %> )[0] .value +'}',
contentType: application / json; charset = utf-8,
dataType:json,
成功:OnSuccess,
失败:函数(响应){
alert(response.d) );
}
});
}
函数OnSuccess(响应){
alert(response.d);
}
< / script >
提前致谢并抱歉我的英语不好。
(文件).ready(function(){
(#B1)。click(function(){
ShowCurrent();
} );
});
< / script >
功能
< script >
function ShowCurrent(){
.ajax({
type:Post,
url:WebForm3.aspx / GetData,
data:'{s:'+
I have a button called B1 which is supposed to call the ShowCurrent()
function while on click.The function is working fine when i use it with the button onclick
properties but when i try to play with jquery such as this here, nothing happens.
messed call method?
<script>
$(document).ready(function () {
$("#B1").click(function () {
ShowCurrent();
});
});
</script>
function
<script>
function ShowCurrent() {
$.ajax({
type: "Post",
url: "WebForm3.aspx/GetData",
data: '{s: "' + $("#<%=TextBox1.ClientID%>")[0].value + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
}
});
}
function OnSuccess(response) {
alert(response.d);
}
</script>
Thanks in advance and sorry for my bad english.
(document).ready(function () {
("#B1").click(function () { ShowCurrent(); }); }); </script> function <script> function ShowCurrent() {
.ajax({ type: "Post", url: "WebForm3.aspx/GetData", data: '{s: "' +
这篇关于我可以使这个调用方法有效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!