Tôi đã viết mã sau để nhận kết quả JSON từ webservice.Làm cách nào để lấy khóa và giá trị JSON?
function SaveUploadedDataInDB(fileName) {
$.ajax({
type: "POST",
url: "SaveData.asmx/SaveFileData",
data: "{'FileName':'" + fileName + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var result = jQuery.parseJSON(response.d);
//I would like to print KEY and VALUE here.. for example
console.log(key+ ':' + value)
//Addess : D-14 and so on..
}
});
}
Đây là phản hồi từ webservice:
Xin hãy giúp tôi để in Key và nó là giá trị gia tăng
FWIW, bạn đang thiếu dấu ngoặc đơn đóng ở cuối đoạn mã đầu tiên của mình. – BWDesign