加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

$.ajax返回的页面取里面控件的值

发布时间:2020-12-16 00:16:46 所属栏目:百科 来源:网络整理
导读:A.aspx页面前端脚本 jQuery.ajax({ url: "Search.aspx", data: "UserId=" + info, cache: false, success: function (html) { var t = (jQuery("#lblshow"),(jQuery(html))).text();//获取返回页面控件span 的id 为lblshow的内容 if (t == "") { jQuery("#dd

A.aspx页面前端脚本

jQuery.ajax({

url: "Search.aspx",
data: "UserId=" + info,
cache: false,
success: function (html) {
var t = (jQuery("#lblshow"),(jQuery(html))).text();//获取返回页面控件span 的id 为lblshow的内容
if (t == "") {
jQuery("#ddBank").dialog('close');


} else {
//alert(t);
var gsdm = '';
if (jQuery("#sddlCompanyName").val().indexOf('请选择') > -1)
{ }
else {
gsdm = jQuery("#sddlCompanyName").val();
}
SeachBankCode(t,'',gsdm);
}
}

});


Search.aspx页面

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Sheets_Search" %>


<!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 runat="server">
<title></title>
</head>
<body>
<asp:Label ID="lblshow" runat="server" Text=""></asp:Label>
</body>
</html>


Search.aspx后台代码

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Maticsoft.DBUtility; public partial class Sheets_Search : System.Web.UI.Page { protected void Page_Load(object sender,EventArgs e) { if (!IsPostBack) { this.lblshow.Text = ""; string sntext = Request.QueryString["UserId"].ToString().Trim(); if (sntext == "" || sntext == null) { this.lblshow.Text = ""; } else { if (DbHelperSQL.Query("select * from ot_user where ObjectID='"+sntext+"'").Tables[0].Rows.Count > 0) { this.lblshow.Text = DbHelperSQL.Query("select * from ot_user where ObjectID='" + sntext + "'").Tables[0].Rows[0]["EmployeeNumber"].ToString().Trim(); } else { this.lblshow.Text = ""; } } } } }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读