A
A
Alexander Tokmakov2014-08-20 20:52:21
PHP
Alexander Tokmakov, 2014-08-20 20:52:21

How to change input without reload?

Hello. Tell me which way to dig. There is an input field whose value displays the name. The name is retrieved from the database.
Task: Enter a different name there, while it should change in the database without reloading the page. A pop-up notification is desirable.
I don’t ask for a ready-made code, but there must be ready-made solutions !!?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Tokmakov, 2014-08-20
@calliko

For those who are interested. found!!!!

<script type="text/javascript">
         function send(url,form_id,result_div)
         {    // Отсылаем паметры
             $.ajax({
                 type: "POST",
                 url:  url,
                 data: $("#"+form_id).serialize(),
                 // Выводим то что вернул PHP
                 success: function(html)
                 {   $("#"+result_div).empty();
                     $("#"+result_div).append(html);
                 },
                 error: function()
                 {  $("#"+result_div).empty();
                     $("#"+result_div).append("Ошибка!"); } }); }
   </script>
                                </head>
                                <body>
        <div id="result">

required in the form:
<form  role="form" action="javascript:send('file.php','myform','result');" id="myform"   method="post">

I
Ivan, 2014-08-20
@0neS

ajax

I don’t ask for a ready-made code, but there must be ready-made solutions !!?
this five

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question