What is wrong with my code that i can not show anything in resultTXT
txtfld shows the array
[{
"user_id": "2790",
"freelancer_name": "",
"order_id": "9121",
"orderamount": "0.00",
"payment_method": " ....... "
}]
I want the user ID to be in resultTXT
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
$.post('userfind.php', function(data) {
$("#txtfld").val(data);
var json = data,
obj = JSON.parse(json);
alert(""+obj.user_id);
$("#resultTXT").val(obj.user_id);
},'json');
}
};
ajaxRequest.open("POST", "userfind.php", true);
ajaxRequest.send(null);
Please help me what should be changed.
ajaxRequest.open? Use either jQuery AJAX or vanilla JS AJAX, not both.