youlichika — 2011-05-05T07:05:00-04:00 — #1
Hello all. I have many tags. I want click each tag, then post/get the tag's value to another page.
In another page, received the values and make a mysql query. Then return the resalt data to the first page(do not make an iframe).
I think jquery post and load may be can do that (but have no idea how to combine two functiton). Or maybe there have any other way. Thanks.
here is my code
<a href="data.php?get=hml05">model:hml05</a><!--post value from products.php-->
...<!--many other tags -->
<div class="show_data"></div><!-- get the data back show in here without refresh the page.
$result = mysql_query("SELECT id,name,details,add_date,model FROM ctw_products WHERE (MATCH (name,details,model) AGAINST ('+$_GET['get']' IN BOOLEAN MODE) Order By add_date DESC LIMIT 20 "); // get value with a mysql query
while ($row = mysql_fetch_array($result))
echo '<div class="name">'.$row['name'].'</div>';
echo '<div class="model">'.$row['model'].'</div>';
echo '<div class="details">'.$row['details'].'</div>';// how to return this part of datas back to products.php
You should look into ajax. It's very simple to use and it will do pretty much exactly what you're looking for.
paul_wilkins — 2011-05-05T20:10:12-04:00 — #3
The best reference that I've found for learning how to write your own ajax code is Bulletproof Ajax
youlichika — 2011-05-06T16:27:50-04:00 — #4
Thanks, but it will cost more time to read a book. If there is a simple demo, I think I can quickly learn...
paul_wilkins — 2011-05-06T17:13:44-04:00 — #5
If you go to the web page for [Bulletproof Ajax you will see that all of the [url="http://bulletproofajax.com/code/"]code and examples](http://bulletproofajax.com/code/) are freely provided too.
Note though that there are several examples of each type, as they work their way through different techniques to achieve more flexible results.