ajsmith_codes
1 month ago
521
39
Laravel

Solved: Ajax request data returns as object - how to populate multiple inputs?

Posted 1 month ago by ajsmith_codes

I make an Ajax call to get contact data. I had it working where I was getting 1 piece of data: email. The returning data would populate into an input: $('input[name="email"]').val(data);

I now need to get Email and Phone. I can successfully get the data returned, but I can't seem to populate the two separate input fields.

If I do that now, I get an object. I then tried this but it doesn't work either:

$('input[name="email"]').val(data["email"]); $('input[name="number"]').val(data["phone"]);

What am I missing here?

Please sign in or create an account to participate in this conversation.