我如何获得“Val.Mailid”来自(Intellisense)Jquery函数? [英] How Do I Get "Val.Mailid" From (Intellisense) In Jquery Function?
本文介绍了我如何获得“Val.Mailid”来自(Intellisense)Jquery函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我没有声明或创建任何包含MailId的表。我使用实体模型方法连接数据库。
< span class =code-keyword>< script >
$(document).ready(function(){
$ .ajax(
{
type:'GET',
dataType:'json',
contentType: 'application / json; charset = utf-8',
url:'http:// localhost:53499 / api / Values',
success:function(data){
// alert (URL)
try {
debugger;
var html ='< table > < thead > < th > 邮件ID < / th > < th > 订阅ID < / th > < th > 订阅日期< / th > < / thead > < tbody > ';
$ .each(data,function(key,val){
debugger;
html + ='< tr > < td > '+'< a ' + 'href = mailto:'+ val.MailID +' > '+ val.MailID +'< / a > '+'< / td > < td > '+ val.SubscriberID +'< / td > < td > '+ val.SubscribedDate +'< / td > < / tr > ';
});
html + ='< / tbody > < / table > 跨度>';
$('#myGrid')。html(html);
} catch(e){
console.log(格式化数据时出错:'+ e.message)
}
},
错误:function( xhrequest,error,thrownError){
console.log('ajax call时出错:'+ error)
}
}
);
});
< / script >
从此链接复制的代码使用Web API从数据库加载数据 [ ^ ]
请找到这个链接。
解决方案
(document).ready(function(){
.ajax(
{
类型:'GET',
dataType:'json',
contentType:'application / json; charset = utf-8',
url:'http: // localhost:53499 / api / Values',
success:function(data){
// alert(URL)
tr y {
调试器;
var html ='< table > ; < thead > < th > 邮件ID < / th > < span class =code-keyword>< th > 订阅ID < / th > < th > 订阅日期< / th > < / thead > < tbody > ';
.each(data,function(key,val){
debugger;
html + ='< tr > ; < td > '+'< a ' + 'href = mailto:'+ val.MailID +' > '+ val.MailID +'< / a > '+'< / td > < td > '+ val.SubscriberID +'< span class =code-keyword>< / td > < td > '+ val.SubscribedDate + '< / td > < span class =code-keyword>< / tr > ';
});
html + ='< / tbody > < / table > 跨度>';
I have not declared or created any table which contains "MailId". I connect database by using entity model method.
<script>
$(document).ready(function () {
$.ajax(
{
type: 'GET',
dataType: 'json',
contentType: 'application/json;charset=utf-8',
url: 'http://localhost:53499/api/Values',
success: function (data) {
//alert(URL)
try {
debugger;
var html = '<table> <thead> <th>Mail ID</th> <th>Subscription ID</th> <th> Subscription Date </th> </thead><tbody>';
$.each(data, function (key, val) {
debugger;
html += '<tr><td>' + '<a ' + 'href="mailto:' + val.MailID + '">' + val.MailID + '</a>' + '</td><td>' + val.SubscriberID +'</td><td>' + val.SubscribedDate + '</td></tr>';
});
html += '</tbody></table>';
$('#myGrid').html(html);
} catch (e) {
console.log('Error while formatting the data : ' + e.message)
}
},
error: function (xhrequest, error, thrownError) {
console.log('Error while ajax call: ' + error)
}
}
);
});
</script>
The Code copied from this link Load Data From Database Using Web API[^]
Please find this link.
解决方案
(document).ready(function () {
.ajax( { type: 'GET', dataType: 'json', contentType: 'application/json;charset=utf-8', url: 'http://localhost:53499/api/Values', success: function (data) { //alert(URL) try { debugger; var html = '<table> <thead> <th>Mail ID</th> <th>Subscription ID</th> <th> Subscription Date </th> </thead><tbody>';
.each(data, function (key, val) { debugger; html += '<tr><td>' + '<a ' + 'href="mailto:' + val.MailID + '">' + val.MailID + '</a>' + '</td><td>' + val.SubscriberID +'</td><td>' + val.SubscribedDate + '</td></tr>'; }); html += '</tbody></table>';
这篇关于我如何获得“Val.Mailid”来自(Intellisense)Jquery函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文