服务器端代码不从客户端接收数据 [英] server side code not receive data from client side

查看:80
本文介绍了服务器端代码不从客户端接收数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户代码



clientside Code

<script>
var obj = [];
jQuery.support.cors = true;
$(document).ready(function () {
$("#btnLoginobj").click
(
function () {

var StaffCode = $("#txtValue1").val();
var Password = $("#txtValue2").val();
$.ajax({
url: "http://localhost:9320/api/UpdateKYC",
type: "Get",
data: JSON.stringify([StaffCode,Password]),
success: function (data) {
$('#usersection').empty();
for (var i = 0; i < data.length; i++) {
obj[i] = new Object;
obj[i].CenterCode = data[i].CenterCode;
obj[i].LoanCode = data[i].LoanCode;
obj[i].ClientCode = data[i].ClientCode;
obj[i].ClientName = data[i].ClientName;
obj[i].DateApproved = data[i].DateApproved;
obj[i].LoanStatus = data[i].LoanStatus;

$('' + data[i].CenterCode + '' + obj[i].LoanCode + '' + obj[i].ClientCode + '' + obj[i].ClientName + '' + data[i].DateApproved + '' + obj[i].LoanStatus + '').appendTo("#usersection");
}
},
error: function (msg) { alert(msg); }
});
}
);

});










<asp:TextBox ID="txtValue1" runat="server" />
<asp:TextBox ID="txtValue2" runat="server" />
<input type="button" id="btnLoginobj" name="btnLoginobj" value="login with object" />







服务器端






server side

public List GetDetail(List val)
{
List<clientliststructure> ObjclientList = new List<clientliststructure>();
LoginSructure objLoginStructure=new LoginSructure();
objLoginStructure.StaffCode =val[0];
objLoginStructure.Password = val[1];
try
{
string connectionstring = ConfigurationManager.ConnectionStrings["ConnectionStrig"].ConnectionString;
SqlConnection con = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand("select BranchCode from Staff where StaffCode='" + objLoginStructure.StaffCode + "' and Password='" + objLoginStructure.Password + "'", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
BranchCode = reader.GetString(0);
}
reader.Close();
cmd.Dispose();
con.Close();
ObjclientList = new MapClientDatatoModel().Mapclientlist(BranchCode);
return ObjclientList;
}
catch (Exception ex)
{
return ObjclientList;
}

}





描述

从客户端传输数据(人员代码,密码),然后服务器端不接收数据(satffcode,密码)。实际上,我发送数据人员代码和密码,并从服务器



Description
when pass data(staffcode,password) from client side then server side not receive data(satffcode,password). actually i send data staffcode and password and get client list from server

推荐答案

文档)获取客户列表。 function (){
(document).ready(function () {


#btnLoginobj)。点击

function (){

var StaffCode =
("#btnLoginobj").click ( function () { var StaffCode =


#txtValue1)。val();
var 密码=
("#txtValue1").val(); var Password =


这篇关于服务器端代码不从客户端接收数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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