如何将json数据附加到HTML选项卡中的ul元素 [英] How to I append json data to the ul elements in the tab of HTML

查看:111
本文介绍了如何将json数据附加到HTML选项卡中的ul元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将json数据附加到具有图像和日期,名称和消息的div。对于不同的数字,相应的消息我有如何在div.help me.thankyou中应用。



我尝试过:



$(文件).ready(function(){







$(document).on(click,#msg,function(){

var json = null;

$ .ajax({

async:false,

global:false,

类型:POST,

url:http://ivr.callxl.com/CallerPopWebServices/OffLineMessages?Devicetype=web&timezone=+05:30&& ; companyname = gmail72256& date = 2016-04-2015:49:40& role = above& noofrecords = 5,

data:'',

dataType: json,



成功:函数(data,textStatus,jqXHR){

console.log(数据);

json = data;

for(var i = 0; i< json.length; i ++)>

{





}



},

//如果没有来自服务器的共鸣

错误:函数(jqXHR,textStatus,errorThrown){

alert(jqXHR.responseText);

console .log(发生了非常糟糕的事情+ textStatus);

$(#errorResponse)。html(jqXHR.responseText);

},

});



























});

});

解决方案

(document).ready(function(){







(document).on(click,#msg,function(){

var json = null;


.ajax({

async:false,

global: false,

类型:POST,

url:http://ivr.callxl.com/CallerPopWebServices/OffLineMessages?Devicetype=web&timezone=+05: 30&& companyname = gmail72256& date = 2016-04-2015:49:40& role = above& noofrecords = 5,

data:'',

dataType:json,



成功:函数(data,textStatus,jqXHR){

console.log(data);

json = data;

for(var i = 0; i< json.length; i ++)>

{





}



},

//如果有没有来自服务器的共鸣

错误:函数(jqXHR,textStatus,errorThrown){

alert(jqXHR.responseText);

console.log(发生了非常糟糕的事情+ textStatus);

how to append json data to the div am having image and date,name,and message.For differnt numbers theri corresponding messages am having how to apppend in the div.help me.thankyou.

What I have tried:

$(document).ready(function() {



$(document).on("click","#msg", function(){
var json=null;
$.ajax({
async: false,
global: false,
type: "POST",
url: "http://ivr.callxl.com/CallerPopWebServices/OffLineMessages?Devicetype=web&timezone=+05:30&&companyname=gmail72256&date=2016-04-2015:49:40&role=above&noofrecords=5",
data: '',
dataType: "json",

success: function( data, textStatus, jqXHR) {
console.log(data);
json=data;
for(var i=0;i<json.length;i++)>
{


}

},
// If there was no resonse from the server
error: function(jqXHR, textStatus, errorThrown){
alert(jqXHR.responseText);
console.log("Something really bad happened " + textStatus);
$("#errorResponse").html(jqXHR.responseText);
},
});













});
});

解决方案

(document).ready(function() {




(document).on("click","#msg", function(){
var json=null;


.ajax({
async: false,
global: false,
type: "POST",
url: "http://ivr.callxl.com/CallerPopWebServices/OffLineMessages?Devicetype=web&timezone=+05:30&&companyname=gmail72256&date=2016-04-2015:49:40&role=above&noofrecords=5",
data: '',
dataType: "json",

success: function( data, textStatus, jqXHR) {
console.log(data);
json=data;
for(var i=0;i<json.length;i++)>
{


}

},
// If there was no resonse from the server
error: function(jqXHR, textStatus, errorThrown){
alert(jqXHR.responseText);
console.log("Something really bad happened " + textStatus);


这篇关于如何将json数据附加到HTML选项卡中的ul元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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