Jquery Use Returned Value of Json object
$('#SubmitAttribute').click(function () {
var productid = $('#ProductId :selected').val();
var source = {
'ProductId': $('#ProductId :selected').val(),
'ProductAttributeId': $('#ProductAttributeId :selected').val(),
}
$.ajax({
type: "POST",
datatype: 'jsonp',
data: source,
url: "/api/ProductAttributeMapping/",
success: function (results) {
resultvalue = results;
}
}).done(function (data, status, jqXHR) {
$('#attributelist').html("");
$.getJSON('/ProductAttributes/GetAttributes/' + resultvalue.ProductId, function (data) {
$.each(data, function (index, items) {
$("#attributelist").append(items.Text + '<br />');
});
})
});
});
var productid = $('#ProductId :selected').val();
var source = {
'ProductId': $('#ProductId :selected').val(),
'ProductAttributeId': $('#ProductAttributeId :selected').val(),
}
$.ajax({
type: "POST",
datatype: 'jsonp',
data: source,
url: "/api/ProductAttributeMapping/",
success: function (results) {
resultvalue = results;
}
}).done(function (data, status, jqXHR) {
$('#attributelist').html("");
$.getJSON('/ProductAttributes/GetAttributes/' + resultvalue.ProductId, function (data) {
$.each(data, function (index, items) {
$("#attributelist").append(items.Text + '<br />');
});
})
});
});
Comments