tags:

views:

139

answers:

3

I create dropdown fields to show the data from a MySQL database. Everytime when I key in new data, it must refresh to read the new data. I know Ajax can do it as well. But any other idea to solve this problem without refreshing to get the new data? Just when new data key in, it will auto renew without pressing F5 or refresh.

This is my code:

<th  style="width:25%"><font><div align="left">Select Product :</div></font>
    <?php echo $form->input('Product',array(
        'label'    => 'Select Products',
        'options'  => $products,
        'id'       => 'product',
        'style'    => 'width:250px;height:100px',
        'selected' => $html->value('Product.Product'),
        'onchange' => 'List();')); ?>
</th>
<th >
A: 

The only way to do this without a refresh is with Ajax (httpRequest). There is, of course, the possibility, that you put your select box into an iFrame and refresh only this, but I think that's bad practice. Why wouldn't you use Ajax?

Pesse
Cause i not familier in ajax. So ask get any other way..
JaYwZx
Use javaScript libraries like jquery (http://jquery.com/) - it's really not that hard!
Pesse
+1  A: 

I think at that point your only option is to get a magical update fairy which performs updates without performing updates.

Seriously though, Ajax isn't that hard for something this simple.

James
A: 

There is such thing as comet. With use of it you can make action to happen in browser by the server side's willing.

Andrew Dashin
How to make it?
JaYwZx