【问题标题】:Query DataBase With PHP + AJAX/JQUERY使用 PHP + AJAX/JQUERY 查询数据库
【发布时间】:2014-05-24 12:59:13
【问题描述】:

喜欢帮助我。我有一个表单,当我写一个用户的 ID 时,显示一个带有该 ID 的用户数据的 div,而不刷新页面。我该怎么办?

我的表格:

            <form action="#" method="post" onsubmit="return validar(this)" id="form_aviso" class="form-validate">
                <input type="hidden" name="form_send" value="send" />
                    <b><span name="user">ID Utilizador:</span></b>
                <input type="text" name="iduser" class="iduser" id="iduser" />
                    <input type="submit" class="botao" align="right" value="Submeter" name="send" />
</form>   

【问题讨论】:

标签: php jquery ajax html refresh


【解决方案1】:

在 jQuery 中:

var user_id = $("#id_of_that_field").val()

或:

$.post("<server>/get_user_info",{user_id:user_id},function(data){
    $("#result_div").html(data) 
})

【讨论】:

  • OP 想要从给定 ID 的数据库表中获取数据,然后将该数据显示给用户。这是怎么做到的?
猜你喜欢
  • 1970-01-01
  • 2019-08-15
  • 1970-01-01
  • 2012-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多