A
A
arsenaljek2020-05-14 12:11:37
PHP
arsenaljek, 2020-05-14 12:11:37

Immediately output ajax data after submitting the form?

I have this form

spoiler

5ebd0a6a2da74773044859.jpeg

It is necessary that after clicking on the "change" button, the right block with data changes to those in the form.
$("#userEdit").submit(function(e){
        e.preventDefault();
        $.ajax({
            type: "POST",
            url: "/../ajax/userEdit.php",
            data: $("#userEdit").serialize(),
            success: function(data){
              $("#content").html(''); 
              toastr.success('Даннные успешно изменены!');  
        }
      });
    });

Data output
<div class="card mb-3">
                              <div class="card-body">
                                <div id="content"></div>
                                <div class="text-muted mb-1 mt-1">E-Mail/Логин</div>
                                <span class="mt-1"><?=$rowUser['email']?></span>
                                <div class="text-muted mb-1 mt-1">ФИО</div>
                                <span class="mt-1"><?=$nameUser?></span>
                                <div class="text-muted mb-1 mt-1">Телефон</div>
                                <span class="mt-1"><?=$rowUser['phone']?></span>
                                <div class="text-muted mb-1 mt-1">Компания</div>
                                <span class="mt-1"><?=$rowUser['company']?></span>
                                <div class="text-muted mb-1 mt-1">Город</div>
                                <span class="mt-1"><?=$rowUser['city']?></span>
                              </div>
                            </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2020-05-14
@Sanes

Give back the new data and output it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question