创建一个页面,更新无需重新加载 [英] Creating a page that updates without reloading

查看:79
本文介绍了创建一个页面,更新无需重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在辩论什么,我应该学会做到这一点。主要如果我走一堆信息从数据库加载页上什么是操纵页面而不必重新加载的最佳方式。就是用类似XML的最好的事情或者是有别的东西,我应该使用。我知道很多这种使用HTML DOM和XML DOM,但我不想开始学习1的还以为我不需要。

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 and not have to reload. Is the best thing to use something like XML or is there something else I should use. I know a lot of this uses HTML Dom and XML Dom, but I dont want to start learning one yet that I dont need.

推荐答案

您正在寻找该技术的名称是AJAX,它代表了异步JavaScript和XML(尽管大多数AJAX这些天使用JSON [JavaScript对象符号]代替的XML)。

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需要JS和DOM的知识。看看 jQuery的作为一个库,使AJAX和DOM操作简单。

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

如何组合在一起的:

Java脚本,使异步请求到服务器(无需刷新页面)返回所需的数据。当请求完成后,JS然后插入该数据到DOM

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

使用jQuery简化了这一过程:

Using jQuery simplifies this process:

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

将获取我-data.html?得到=数据,并把返回的HTML与ID一个div数据容器的id

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

这篇关于创建一个页面,更新无需重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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