是否可以在不刷新整个页面的情况下加载页面内容 [英] Is it possible to load content of page without Refreshing the whole page

查看:92
本文介绍了是否可以在不刷新整个页面的情况下加载页面内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我想刷新我的页面内容而不用刷新整个页面通过JavaScript或j查询.......然后我将我的整个项目放到(Php或javaScript)中,所以我遇到了这样的问题

Actually i want to refresh my content of a page without Refreshing the whole page through JavaScript or j Query ....... and i did my whole project into ( Php or javaScript) so i face such type of problem

注意:我想在用户执行某些操作时刷新页面内容

Note : i want to refresh my page content when user do some action

这是我的代码:

//点击按钮,下面将执行:

//On Button click, the below will be execute:

  $('body').on('click', '#click', loadDoc); 

和LoadDoc功能:

and the LoadDoc functio:

   function loadDoc() { 

                                //alert('heruybvifr');
                var _this = $(this); 
                var order_id= $(this).parents('.modal').find('.order-id').text(); 

                $.get('myPHP.php',{order_id: order_id},function(){ 
             _this.hide();

                }) 
                }

现在myPHP.php:

Now myPHP.php :

  <?php
 include("connection.php");
 $limit = intval($_GET['order_id']);

echo $valuek;
    $query="UPDATE orders
SET status ='cooking'
 WHERE id = $limit";
if (mysqli_query($connection,$query)) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . mysqli_error($connection);
 }


  ?> 


推荐答案

是的,你可以使用 jQuery.ajax()调用。像这样:
使用AJAX请求更改元素的文本:

Yes you can use the jQuery.ajax() call. Like this: Change the text of a element using an AJAX request:

$("button").click(function(){
    $.ajax({url: "demo_test.txt", success: function(result){
        $("#div1").html(result);
    }});
});

有关详细信息,请参阅本教程:
http://www.w3schools.com/jquery/ajax_ajax.asp

See this tutorial for more information: http://www.w3schools.com/jquery/ajax_ajax.asp

这篇关于是否可以在不刷新整个页面的情况下加载页面内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆