У меня есть формы HTML, чтобы представить некоторую информацию:Php Аякса после ожидающего сообщения
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#form form').submit(function(){
$.get('data.php', $(this).serialize(), function(data){
$('#content').html(data);
});
return false;
});
});
</script>
</head>
<body>
<div id="form">
<form>
IP : <input type="text" name="urname"><br/>
Port : <input type="text" name="urbirth"><br/>
<input type="submit" name="submit" value="Submit">
</form>
</div>
<div id="content">
</div>
который использует этот PHP:
<?php
error_reporting(0);
$name = strtoupper($_REQUEST['urname']);
$birth = strtoupper($_REQUEST['urbirth']);
$address = "$name"; //Here you can specify the address you want to check ports
$port = "80"; //Here you can specify the port you want to check from $address
$checkport = fsockopen($address, $port, $errnum, $errstr, 2); //The 2 is the time of ping in secs
//Here down you can put what to do when the port is closed
if (!$checkport) {
echo "The port " . $port . " from " . $address . " seems to be closed."; //Only will echo that msg
} else {
//And here, what you want to do when the port is open
echo "The port " . $port . " from " . $address . " seems to be open."; //The msg echoed if port is open
}
?>
Поскольку это занимает много времени, чтобы получить ответ от сервера , Я хотел бы показать сообщение ожидающего ответа в ожидании ответа ajax. Как мне это сделать?
Что вопрос? Было бы проще, если бы вы сказали нам, что не так/с чем вы сталкиваетесь. –
смотрите, когда пользователь нажимает кнопку «Отправить», требуется много времени, чтобы показать результат, поэтому я хочу в это время сделать сообщение appering вроде: «Waint Please ...» –