Creating a page that updates without reloading

后端 未结 1 565
野性不改
野性不改 2020-12-22 00:32

I am debating on what to I should learn to accomplish this. Mainly If I take a bunch of info from a database to load on a page what is the best way to manipulate the page an

相关标签:
1条回答
  • 2020-12-22 01:03

    The name of the technique you are looking for is AJAX, which stands for Asynchronous Javascript and XML (although most AJAX these days uses JSON [JavaScript Object Notation] instead of XML).

    AJAX requires working knowledge of JS and the DOM. Look at jQuery as a library that makes AJAX and DOM manipulation easy.

    How it fits together:

    Javascript makes asynchronous requests to your server (without refreshing the page) that return the required data. When the request completes, the JS then inserts that data into the DOM

    Using jQuery simplifies this process:

    $('#data-container-id').load("my-data.html",{get:"data"})
    

    will fetch "my-data.html?get=data" and put the returned html into a div with the id "data-container-id"

    0 讨论(0)
提交回复
热议问题