データをドロップダウンリストにバインドしましたが、ボタンをクリックすると、選択したアイテムの値が必要ですが、取得できません。また、更新されます。
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "POST",
async: false,
contentType: "application/json; charset=utf-8",
data: "{}",
url: "Drpodownlistbindingjquery.aspx/getdata",
dataType: "json",
success: ajaxSucceess,
error: ajaxError
});
function ajaxSucceess(response){
$.each(response.d, function (key, value) {
$("#ddlCategory").append($("<option></option>").val(value.Sname).html(value.Sno));
});
}
function ajaxError(response){
alert(response.status + ' ' + response.statusText);
}
});
</script>
そして、私の2番目の問題は
<script type="text/javascript">
$(document).ready(function() {
$("#btnsubmit").click(function(){
$.ajax({
type: "get",
url: "loginform.aspx/getdataval",
data:'{"uname":"'+$("#TextBox1").val()+'","passwod":"'+$("#TextBox2").val()+'"}',
contentType: "application/json;charset=utf-8",
dataType: "json",
sucess:function(data){
var Emp=data.d;
alert('welcome');
$("#output").append('<p>'+Emp.Sname+ ' ' + Emp.Sno+'</p>');
//here i want to give redirect link
},
error: function(e) {
alert(e);
}
});
});
});
</script>
ユーザー名とパスワードを比較していますが、エラーが発生します。ここで何か問題がありますか?
Drpodownlistbindingjquery.aspxはタイプミスではありません。前もって感謝します。