自己送信フォームを使用してデータを処理していましたが、個別に処理する必要があるため、フォームを送信して結果を返し、divに配置する必要があります。フォームがある元のページにデータを戻すには、これを使用AJAX
するのが良い方法のようです。私はたくさんの例を見てきましたが、それをどのように行うか、または実際にどのように機能するかを本当に理解していません。
このフォームデータをindex.php
プロセスページに送信して、処理twitterprocess.php
されたデータを表示するために何をする必要があるかを確認したいとします。
<form method="POST" action="twitterprocess.php">
Hashtag:<input type="text" name="hashtag" /><br />
<input type="submit" value="Submit hashtag!" />
</form>
これは私が結果を表示するために使用しているものです。
<?php foreach($results as $result) {
$tweet_time = strtotime($result->created_at);?>
<div>
<div class="tweet"> <?php echo displayTweet($result->text),"\r\n"; ?>
<div class="user"><?php echo "<strong>Posted </strong>" . date('j/n/y H:i:s ',$tweet_time) ?><strong> By </strong><a rel="nofollow" href="http://twitter.com/<?php echo $result->from_user ?>"><?php echo $result->from_user ?></a></div>
</div>
<br />
<? } ?>
私はAJAXを初めて使用しますが、ガイダンスをいただければ幸いです。