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

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 = ""; } } } } }

相关文章

$.AJAX()方法中的PROCESSDATA参数 在使用jQuery的$.ajax()方...
form表单提交的几种方式 表单提交方式一:直接利用form表单提...
文章浏览阅读1.3k次。AJAX的无刷新机制使得在注册系统中对于...
文章浏览阅读1.2k次。 本文将解释如何使用AJAX和JSON分析器在...
文章浏览阅读2.2k次。/************************** 创建XML...
文章浏览阅读3.7k次。在ajax应用中,通常一个页面要同时发送...