dongmu3269 2015-04-13 10:10
浏览 628

刷新Div的内容而不刷新整个页面

I have around 90 divisions in my page which can navigated by next and previous buttons.

Now these divisions have textboxes which retrieves tables values from the database on page refresh.

The thing with this kind of refresh is that if I'm on the 67th division and the page reloads, it goes back to the first divsion. I want that if I press a button inside any div, that div only will refresh with new table values from the database.

I have come across several codes, but none of it refreshes the div at realtime, for example if I save two textbox values, it will show the textbox values at that time. If I go then to phpmyadmin and delete one of the rows, come back to the textbox and press the refresh button,it should just update the textbox values with new data, in this case only first row should be present

$result = mysql_query("SELECT * FROM du_contacts where DU_no=$du_no");
$row = mysql_fetch_array($result);

<td><input type="Text" name="DU"  maxlength="25" value="<?php echo $row[1]; ?>" id="DU_contact_name_0" >

This is how i retrieve data in to the textbox.. all i want is when i press a button, the data in the textbox should change to the recent data in table.

  • 写回答

2条回答 默认 最新

  • duanmoen784988 2015-04-13 10:19
    关注

    Use ajax call or load to make that div content refresh its data

    $("#id").load('content.html');
    

    or

    $.ajax({
            type:"GET",
            url:"your_url",
            data: qS,
            datatype: 'html',
            success: function(data){
               $("#div").html(data);
            }
        }).done(function() {
            alert('done')
        });
    

    Try this out: https://stackoverflow.com/a/22577506/2498251

    An example:

    http://jsfiddle.net/pX5kr/

    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况