G
G
GaserV2015-10-23 13:50:44
JavaScript
GaserV, 2015-10-23 13:50:44

How to display some content in a modal window?

Tell. Here are my articles. Next to them are the "Delete" and "Edit" buttons. It is necessary that when you click on "Edit" the article is displayed in a modal. How to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2015-10-23
@dzheka3d

If without any checks, in short there will be something like this:
On the jquery side:

function edit(id){
  $.get("/edit.php",
  {id:id},
  function(c){
                $("body").prepend(c);
    $("#dialog").dialog({
    autoOpen:true,
    show:"fade",
    hide:"fade",
    modal: true,
    buttons: {
      "Изменить": function() {
        Save();
      },
      "Отмена": function() {
        $( this ).dialog( "close" );
      }
      	}
  });
  });
return false
};

In edit.php file something like:
$res = mysql_query('SELECT * FROM `statja` WHERE `id` = $_GET[id]');
$row = mysql_fetch_assoc($res);
echo "<div id='dialog' title='Редактирование статьи'>
    Тут то, что нужно из $row
</div>";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question