Can someone please tell me what wrong with this jquery because i am not getting any error can not get value in var lbl and var dat
var lbl = [];
var dat = [];
$.ajax({
url: "../Graph/GetData",
type: "Post",
data: "{}",
dataType: "json",
success: function (data) {
$.each(data, function (key, value) {
lbl.push[value.Item];
dat.push[value.price];
alert("Item" + lbl + " Price" + dat)
})
}
});
Answers (1)
0
Hi Shiv,
use the below code.
- var lbl = [];
- var dat = [];
- $.ajax({
- url: "../Graph/GetData",
- type: "Post",
- data: "{}",
- dataType: "json",
- success: function (data) {
- $.each(data, function (key, value)
- {
- lbl.push(value.Item);
- dat.push(value.price);
- alert("Item" + lbl + " Price" + dat);
- })
- }
- });
Accepted