I am trying to get the success response to send the values from ajax into their respective fields. For whatever reason I can't get that to happen. In the success section I am issuing a "alert(responseObject)" in which the results are in the attached image. So the data is coming back just as I want it, but I can't get the values to populate into the matching fields.
$(document).ready(function() {
function myrequest(e) {
var man_part_number = $('#man_part_number').val();
$.ajax({
method: "GET",
url: "includes/autofill.php",
data: {
man_part_number: man_part_number
},
success: function(responseObject) {
alert(responseObject);
//This alert response results is in attached image
$('#manufacture').val(responseObject.manufacture);
$('#model').val(responseObject.model);
$('#type').val(responseObject.type);
},
failure: function() {
alert('fail');
}
});
}
$('#fetchFields').click(function(e) {
e.preventDefault();
myrequest();
});
});
<button type="button" id="fetchFields">Fetch</button>
<input type="text" name="manufacture" id="manufacture" />
<input type="text" name="model" id="model" />
<input type="text" name="type" id="type" />