基本信息
源码名称:jquery post json数据 例子源码下载
源码大小:0.02M
文件格式:.rar
开发语言:C#
更新时间:2014-11-11
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>.NET下jQuery-post方法应用</title> <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> </head> <body> <div style="margin:15px; font-size:13px;"> 加法: <input type="text" id="txt_1" name="txt_1" maxlength="5" style="width:50px;" /> <input type="text" id="txt_2" name="txt_2" maxlength="5" style="width:50px;" /> <input type="button" id="btn_1" value="计算" /> <span id="span_1" style="color:Red; font-weight:bold; font-size:14px;">结果:</span> <br /> 乘法: <input type="text" id="txt_3" name="txt_3" maxlength="5" style="width:50px;" /> × <input type="text" id="txt_4" name="txt_4" maxlength="5" style="width:50px;" /> <input type="button" id="btn_2" value="计算" /> <div id="div_2" style="color:Red; font-weight:bold; font-size:14px;">结果:</div> </div> <script type="text/javascript"> $("#btn_1").click(function(){ //验证 if ($("#txt_1").val()=='' || $("#txt_2").val()=='') { alert('请输入要计算的值'); return false; } //向add.ashx请求结果 $.post('Enumerate/add.ashx',{ //参数一 num1: $('#txt_1').val(), //参数二 num2: $("#txt_2").val() }, //回调函数 function(theback) { //输出结果 $("#span_1").text(theback); }, //返回类型 "text" ); }); $("#btn_2").click(function(){ //验证 if ($("#txt_3").val()=='' || $("#txt_4").val()=='') { alert('请输入要计算的值'); return false; } //向multiply.ashx请求结果 $.post('Enumerate/multiply.ashx',{ //参数一 num1: $('#txt_3').val(), //参数二 num2: $("#txt_4").val() }, //回调函数 function(theback) { //输出结果 $("#div_2").html('第一个数:' theback.num1 '<br />' '第二个数:' theback.num2 '<br />' '算法类型:' theback.type '<br />' '计算结果:' theback.result); }, //返回类型 "json" ); }); </script> </body> </html>