這個代碼我componentDidMount後寫:打印文本字段的JSON數據作出反應JS
componentDidMount: function() {
var url = document.URL;
var currentId = url.substring(url.lastIndexOf('?') + 4);//getting the current ID from the url
var data = {
idtoUpdate: currentId
};
$.ajax({
type: 'POST',
url: 'test.php',
data: data,
success: function(response) {
var result = $.parseJSON(response);
$("#briefinfo").html(response);//This response will prints the JSON format data which is return by test.php
}
})
.done(function(data) {
})
.fail(function(jqXhr) {
console.log('failed to register');
});
},
在這裏我得到了JSON格式代碼,當我回到它打印響應 所以我要打印這個數據在文本字段
我建議存儲狀態和渲染方法中的響應寫狀態值作爲輸入/特克斯的值tarea標籤。 – hazardous