Is it possible to load content of page without Refreshing the whole page

后端 未结 3 562
执笔经年
执笔经年 2021-01-25 12:08

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

相关标签:
3条回答
  • 2021-01-25 12:23

    You can load the data from the server and and place the returned HTML into the matched element.

    <div id="content"></div>
    
    $("#content").load( "ajax/test.html" );
    
    0 讨论(0)
  • 2021-01-25 12:26

    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);
        }});
    });
    

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

    0 讨论(0)
  • 2021-01-25 12:29

    You can use JQuery Ajax functions to accomplish your requirement. all there functions given below will work for loading the content without refreshing the page.

        $.post("/controller/function", params, function(data) {
            // set received data to html
        });
    
    $.ajax("/controller/function", params, function(data) {
            // set received data to html
        });
    
    $.get("/controller/function", params, function(data) {
            // set received data to html
        });
    
    0 讨论(0)
提交回复
热议问题