点击按钮,我们从数据库中获取数据,我需要在文本字段中显示数据,但它显示空值。
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Biz Biliriz</title>
</head>
<body>
<h1>Question 1</h1>
<div class="container">
<div class="setters">
<div class="minutes-set">
</div>
<div class="seconds-set">
</div>
</div>
<div class="circle"> <svg width="300" viewBox="0 0 220 220">
<g transform="translate(110,110)">
<circle r="100" class="e-c-base"/>
<g transform="rotate(-90)">
<circle r="100" class="e-c-progress"/>
<g id="e-pointer">
<circle cx="100" cy="0" r="8" class="e-c-pointer"/>
</g>
</g>
</g>
</svg> </div>
<div class="controlls">
<div class="display-remain-time">01:00</div>
<button class="play" id="pause"></button>
</div>
</div>
<div class="sidebar">
<div class="setters">
<p>Test Question</p>
</div>
</div>
$("#btnClick").click(function () {
var id = jQuery('[id$=hfCustomer]').val();
$.get("GenericName_Bind", { ProductID: id }, function (data) {
$('#txtGenericName').val(data);
});
答案 0 :(得分:0)
最后我找到了答案
$("#btnClick").click(function () {
var id = jQuery('[id$=hfCustomer]').val();
$.get("GenericName_Bind", { ProductID: id }, function (data) {
$.each(data, function (i, v1) {
$('#txtGenericName').val(v1.Text);
});
});
});