AJAX页面加载 [英] AJAX page loading
问题描述
我是AJAX编程(和JavaScript)的新手,但我已经很快就接受了这个想法。但我有个问题。随着我正在努力的项目
,我想动态加载主页
。现在,它只是一个PHP脚本,可以在调用时加载
信息。但是,我可以看到一些问题,即b
。我想要做的是在页面加载时通过
JavaScript / AJAX调用php脚本。我只是不确定这样做的最佳方式是什么。
。我以为我可以创建多个XMLHttpRequest
对象,只需修改我的脚本以使用不同的XMLHttpRequests。
这是最好的方法吗?
I''m new to AJAX programming (and JavaScript), but I''ve been picking up
the idea pretty quick. I have a question though. With the project
that I''m working on, I would like to have the main page loaded
dynamicly. Right now, it''s just a php script that loads the
information when it''s called. But, I can see some problems cropping
up. What I want to do is call the php scripts when the page loads via
JavaScript/AJAX. I''m just not sure what the best way to do this would
be. I was thinking that I could create multiple XMLHttpRequest
objects, and just modify my scripts to use different XMLHttpRequests.
Would this be the best way to do this?
推荐答案
pa ** *********@gmail.com 写道:
我是AJAX编程(和JavaScript)的新手,但我一直在接受
,我希望动态加载主页面。
I''m new to AJAX programming (and JavaScript), but I''ve been picking up
the idea pretty quick. I have a question though. With the project
that I''m working on, I would like to have the main page loaded
dynamicly.
不要通过JavaScript更改html的错误!
JavaScript *是*和*应*作为附加功能保留。
-
Jonas Raoni Soares Silva
http://www.jsfromhell.com
我没有打算用JavaScript来改变html(我猜你想要的是
你的意思是明确改变了javascript )或者,你的意思是(因为我计划)不要通过XMLHttpRequest对象更改html吗?
这就是我想做的事情,理想情况下:
用户进入主页
基本页面很可能是空白的,或者使用onLoad(可能)很少使用
,调用函数加载信息
- 这些使用XMLHttpRequest来调用php脚本,这就是doe
工作。
然后将结果加载到各自的< div id>标签
这就是你说的,不做?
I wasn''t planning on using JavaScript to change the html (I''m guessing
you mean an explicit change in the javascript) Or, do you mean (as I
am planning) don''t change the html via the XMLHttpRequest object?
This is what I would like to do, idealy:
user gets to main page
basic page is most likely blank, or has very little
using onLoad (probably), call functions to load the information
- these use XMLHttpRequest to call a php script, which does the
work.
the results are then loaded into their respective <div id> tags
Is this what you are saying, don''t do?
Jonas Raoni< jo ********@gmail.com>在新闻中写道:dtkqjj
Jonas Raoni <jo********@gmail.com> wrote in news:dtkqjj
这篇关于AJAX页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!