如何使用jquery在html页面中显示从web api到textbox的jason数据 [英] how to show the jason data from web api to textbox in html page using jquery

查看:60
本文介绍了如何使用jquery在html页面中显示从web api到textbox的jason数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用jquery在html页面中显示从web api到textbox的jason数据????



plzzz给出web api控制器和jquery中的所有代码html代码

how to show the jason data from web api to textbox in html page using jquery????

plzzz give all codes in web api controller and jquery and html code

推荐答案

嗨Zoyajein



Hi Zoyajein

function loadDataByJson() {


.ajax({
type: POST
contentType: application / json
数据:
url: AnyPage.aspx / getData
dataType: json
成功:功能(数据){
bindtablebyjson(data.d);
},
错误: function (XMLHttpRequest,textStatus,errorThrown){
debugger ;
}
});
}
.ajax({ type: "POST", contentType: "application/json", data: "", url: "AnyPage.aspx/getData", dataType: "json", success: function (data) { bindtablebyjson(data.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { debugger; } }); }







这里我在成功功能中以json格式获取数据。比我在下面的函数中处理这些数据:






Here I am getting data in json form in 'success' function. Than I handle this data in below function:

function bindtablebyjson(jSonArray) {
    //alert(jSonArray);
    var textBox =


#txtEmpName)。empty();
var json_parsed =
("#txtEmpName").empty(); var json_parsed =


这篇关于如何使用jquery在html页面中显示从web api到textbox的jason数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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