我有一個網站,用戶可以通過調用一個php頁面提交表單重新發送序列並顯示警報。 如果我不使用jquery,可以在DOM準備好之前顯示串行發件人頁面和警報,並阻止頁面加載。 我想結合PHP和jQuery。
當聲明if (($_GET["email"]!="") && (isset($_GET["submit"])))
返回true,頁面應該 處理給定的數據並顯示警報。
當聲明if (($_GET["email"]=="") && (isset($_GET["submit"])))
頁面應該顯示警告並顯示錯誤消息。如何在需要時加載php頁面並通過jquery顯示警報?
kulcsujra.php負責發送郵件與請求的數據。
我的代碼:
<html>
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<script>
$(document).ready(function() {
<?php
if (($_GET["email"]!="") && (isset($_GET["submit"])))
{include 'kulcsujra.php';}
if (($_GET["email"]=="") && (isset($_GET["submit"]))) {"alert('Adjon meg egy e-mail címet!');";}
?>
});
</script>
</head>
<body>
<form action="" method="get">
<div style="width:285px; border:1px solid white;text-align: center;">
<span><font color="white">E-mail cím: </font></span><input type="text" name="email" size="27"/>
<br><br>
<input type="submit" value="Újraküld" name="submit"/>
</div>
</form>
</body>
</html>
你的代碼現在在做什麼? – mkaatman