Это моя первая страница html страницы first.php. У меня есть форма, включая кнопку div и кнопку отправки. Я хочу, чтобы при нажатии кнопки нажал, открыть новую страницу (second.php) и отображать содержимое DIV (ID = OrderList)Отправка html-формы в php
<form id="orderForm" action="second.php">
<div class="col-md-5" id="orderList">
<h3 align="center">Sipariş Listesi</h3>
</div>
<div>
<button type="submit" id="firstConfirmButton" class="btn btn-primary btn-lg">Onayla</button>
</div>
</form>
Это является частью Javascript;
$("#orderForm").submit(function() {
var content = $('#orderList').html();
console.log(content); //(no problem everything is ok)
$('#confirmForm').val(content);
var content2 = $('#confirmForm').html();
console.log(content2); //(it is null)
});
И это second.php, где я хочу, чтобы отобразить содержимое в DIV (ID = confirmForm)
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="script.js"></script>
<META name=viewport content="width=1024, initial-scale=1">
<META http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="Content-language" CONTENT="tr">
<link href="shift.css" rel="stylesheet">
<link rel="stylesheet" href="bootstrap.css">
<link rel="stylesheet" href="product.css">
</head>
<body>
<div id="confirmForm"> </div>
</body>
</html>
Это не работает, что я должен изменить?
Google 'ajax' с' jquery', если вы хотите, чтобы содержимое второй страницы отображалось на текущей странице, которую вы отправляете, используя асинхронный запрос. – Kypros