如何在asp.net按钮上单击调用以下jquery函数 [英] How to call following jquery function on asp.net button click

查看:54
本文介绍了如何在asp.net按钮上单击调用以下jquery函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 $( document )。ready( function (){ 

$ .ajax({

type:' GET'

url:' https://js.i-parcel。 com',[^]

超时: 15000

成功: function (data){alert(' 已连接到i-parcel。');},

错误: function (XMLHttpRequest,textStatus,errorThrown){alert(' 错误:\\\\ n' + textStatus);}

});

});

解决方案

document )。ready ( function (){


.ajax({

type:' GET'

url:' https://js.i-parcel.com',[^]

timeout: 15000

成功:功能(数据){alert('' 连接到i-parcel。'); },

错误: function (XMLHttpRequest,textStatus,errorThrown){alert('' 错误:\\\\ n' + textStatus); }

});

});


将它放入一个单独的函数中,并使用按钮标签中的OnClientClick属性。



< script type =  文本/ JavaScript的> 

$(document).ready(function () { 

    $.ajax({
 
        type: 'GET',
 
        url: 'https://js.i-parcel.com', [^]
 
        timeout: 15000,
 
        success: function (data) { alert('Connected to i-parcel.'); },
 
        error: function (XMLHttpRequest, textStatus, errorThrown) { alert('Error:\r\n' + textStatus); }
 
    });
 
});

解决方案

(document).ready(function () {


.ajax({ type: 'GET', url: 'https://js.i-parcel.com', [^] timeout: 15000, success: function (data) { alert('Connected to i-parcel.'); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert('Error:\r\n' + textStatus); } }); });


Put it into a separate function and use the OnClientClick attribute in your button''s tag.

<script type="text/javascript">


这篇关于如何在asp.net按钮上单击调用以下jquery函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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