Ajax popluate form with data of json response
hi , sorry for english :
My response of consol.log is:
how can i populatemy form :
<form
method
=
"post"
action
=
"#"
>
<input
name
=
"name"
type
=
"text"
id
=
"name"
value
=
""
/>
<input name="email" type="text" id="email" value="" />
<input name="phone" type="text" id="phone" value="" />
<button class='add'
type
"submit"
>
</form>
This is my ajax:
- $('.add').click(function() {
-
-
- $id_user = $(this).val();
- $.ajax({
- type: "POST",
- url: "<?=site_url(); ?>index.php/ajax_call/return",
- data: {
- id_user:$id_user
- },
- dataType: "json",
- success: function(msg)
- {
- console.log(msg);
- },
- error: function()
- {
- alert("Chiamata fallita, si prega di riprovare...");
- }
- });
- });