It's working! I changed
return json_encode( (array)$data );
To:
return response()->json($data);
And this is the JS code:
$('input[name="email"]').val(data[0].email);
$('input[name="number"]').val(data[0].phone);
Can send a picture of the output instead of pasting the text?
Ok happy to hear that! :)
Actually return json_encode( (array)$data ); and return response()->json($data); are equivalent.
I'm quite confused.
Appreciate if you can pick a best answer. It's 2am. Gtg
I'm not certain why it does that either.
I'm not sure which answer to pick as "Best Answer" since none of them are dead on.
@ajsmith_codes try switching back to return json_encode((array)$data);, I have a feeling it will still work.
I did try that out of curiosity and it didn't work. Weird!
Ok good to know. New info to me. Thanks~
Please or to participate in this conversation.