佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 33492|回复: 110

AJAX

[复制链接]
发表于 20-6-2005 07:29 PM | 显示全部楼层 |阅读模式
了解AJAX, 首先从CARI 网友的一个POST 说起, BACKEND引起了我对AJAV/ RICH INTERNET APPLICATION 的兴趣.

再从WIKIPEDIA 中了解到RICH INTERNET APPLICATION。
这是一项新的WEB APP DEVELOPMENT 趋势。

建议读: http://www.adaptivepath.com/publ ... archives/000385.php
它被运用在 http://maps.google.com

AJAX 技术: http://www.ajaxpatterns.org/

INTERNET 上,分成两种分支:
一为用 FLASH,另一个是JAVASCRIPT+CSS

BACKEND 是JAVASCRIPT 的IMPLMENTATION,不是OSS 的
http://www.backbase.com/index.php

LASZLO 是FLASH 的IMPLEMENTATION,是OSS 的
http://www.laszlosystems.com/partners/support/demos/

最后我找到了JAVASCRIPT+OSS 的ENGINE: SAJAX
http://www.modernmethod.com/sajax/faq.phtml

希望这个贴可以帮到一些人。

评分

参与人数 1人气 +3 收起 理由
月下渔人 + 3 我很赞同

查看全部评分

回复

使用道具 举报


ADVERTISEMENT

发表于 20-6-2005 11:09 PM | 显示全部楼层
exiang 于 20-6-2005 07:29 PM  说 :
了解AJAX, 首先从CARI 网友的一个POST 说起, BACKEND引起了我对AJAV/ RICH INTERNET APPLICATION 的兴趣.

再从WIKIPEDIA 中了解到RICH INTERNET APPLICATION。
这是一项新的WEB APP DEVELOPMENT 趋势。

...


很新的技术?
不过真的很帮!
这将会成为一个趋势。
但是他的安全性可以去到哪里呢?
需要什么compiler吗?有什么软件介绍来弄这个吗?
AJAX会不会成为未来ERP、CRM、SAP的主流?
回复

使用道具 举报

发表于 21-6-2005 03:19 PM | 显示全部楼层
感觉上是很好看, 但是实际用途就不知道了。 还有很多问题, 很多Browser开不到。
回复

使用道具 举报

发表于 21-6-2005 08:14 PM | 显示全部楼层
belon_cfy 于 21-6-2005 03:19 PM  说 :
感觉上是很好看, 但是实际用途就不知道了。 还有很多问题, 很多Browser开不到。


因为它用到

.....
A=new ActiveXObject('Msxml2.XMLHTTP');
.....
A=new ActiveXObject('Microsoft.XMLHTTP');
.....
回复

使用道具 举报

发表于 23-6-2005 12:04 AM | 显示全部楼层
这里也有谈到一点点AJAX和google的东西,可以看看~
http://news.com.com/Will+AJAX+he ... 010.html?tag=st.num
回复

使用道具 举报

发表于 23-6-2005 03:47 AM | 显示全部楼层
起初使用
Gmail
MSN Web Messenger
的时候我就觉得奇怪了。。。
原来是这么一回事, Backend generate XML, Ajax 就process 然后再generate interface/changes.
回复

使用道具 举报

Follow Us
发表于 15-10-2005 12:12 AM | 显示全部楼层

AJAX(Asynchronous JavaScript and XML)

谁学着ajax?

ajax = Asynchronous JavaScript and XML

可以说是无刷新的新技术

gmail就是用这种技术
当我们点击连接或内容时
我们会发现,内容会改变
但是
网页没有且没有刷新(reload/refresh)



个人觉得这个技术是蛮有意思的
就像http://www.bugimus.com/buguest/bugGuest.html(第一次看到这个网页时,感觉就像flash,其实不是flash,而是javascript)


现在在这里简单的做一些示范 (a + b)
本人使用的是vs.net 2005 beta

首先大家可以从这里下载那个ajax.dll。ajax.dll是要加到reference


这里你们会看到一些示范


文件default.aspx也是主页
  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5.     <title>ajax demo 7</title>
  6.     <script language="javescript" type="text/javascript" src="default.js"></script>
  7. </head>
  8. <body>
  9.     <form id="form1" runat="server">
  10.     <input id="num1" type="text" /> + <input id="num2" type="text" /> = <a href="javascript:culculate()" id="result" >result</a>
  11.     </form>
  12. </body>
  13. </html>
复制代码

这个是default.aspx.cs 是 default.aspx的code behind (红色代表要注意的地方)


  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;

  10. public partial class _Default : System.Web.UI.Page
  11. {
  12.     protected void Page_Load(object sender, EventArgs e)
  13.     {
  14.         Ajax.Utility.RegisterTypeForAjax(typeof([color=Red]demo7.classname1[/color]));
  15.     }
  16. }

复制代码


这个是class.cs 默认是在 App_code 文件夹里


  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;

  10. /// <summary>
  11. /// Summary description for Class1
  12. /// </summary>
  13. namespace demo7
  14. {
  15.     public class classname1
  16.     {
  17.         [Ajax.AjaxMethod]
  18.         public int serveradd(int a,int b) {
  19.             return a + b ;
  20.         }

  21.     }
  22. }
复制代码


default.js


  1. // JScript File

  2. function culculate() {
  3. classname1.serveradd(
  4. document.getElementById("num1").value,
  5. document.getElementById("num2").value,
  6. callback
  7. )
  8. }

  9. function callback(res) {
  10.         document.getElementById("result").innerHTML = res.value;
  11. }
复制代码

web.config红色代表一定要加的部分

  1. <?xml version="1.0"?>
  2. <!--
  3.     Note: As an alternative to hand editing this file you can use the
  4.     web admin tool to configure settings for your application. Use
  5.     the Website->Asp.Net Configuration option in Visual Studio.
  6.     A full list of settings and comments can be found in
  7.     machine.config.comments usually located in
  8.     \Windows\Microsoft.Net\Framework\v2.x\Config
  9. -->
  10. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  11.         <appSettings/>
  12.         <connectionStrings/>
  13.         <system.web>
  14.     <httpHandlers>
  15.       <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
  16.     </httpHandlers>
  17.                 <!--
  18.             Set compilation debug="true" to insert debugging
  19.             symbols into the compiled page. Because this
  20.             affects performance, set this value to true only
  21.             during development.
  22.         -->
  23.                 <compilation debug="true"/>
  24.                 <!--
  25.             The <authentication> section enables configuration
  26.             of the security authentication mode used by
  27.             ASP.NET to identify an incoming user.
  28.         -->
  29.                 <authentication mode="Windows"/>
  30.                 <!--
  31.             The <customErrors> section enables configuration
  32.             of what to do if/when an unhandled error occurs
  33.             during the execution of a request. Specifically,
  34.             it enables developers to configure html error pages
  35.             to be displayed in place of a error stack trace.

  36.         <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
  37.             <error statusCode="403" redirect="NoAccess.htm" />
  38.             <error statusCode="404" redirect="FileNotFound.htm" />
  39.         </customErrors>
  40.         -->
  41.         </system.web>
  42. </configuration>

复制代码

[ 本帖最后由 quantum^_^ 于 15-10-2005 12:47 AM 编辑 ]

评分

参与人数 1积分 +50 收起 理由
fxam + 50 与extrem23的帖合并 .

查看全部评分

回复

使用道具 举报

发表于 15-10-2005 12:16 AM | 显示全部楼层
点击放大

点击放大
回复

使用道具 举报


ADVERTISEMENT

发表于 15-10-2005 07:18 AM | 显示全部楼层
那要用Microsoft Visual Studio Dot Net来Edit吗?还是Notepad也可以?????
回复

使用道具 举报

发表于 15-10-2005 09:19 AM | 显示全部楼层
很好的东西。

但是,是不是server也要support ajax才有用呢?
回复

使用道具 举报

发表于 15-10-2005 09:49 AM | 显示全部楼层
哈哈~本来我也想开个有关AJAX的贴的。

AJAX其实不是一门新技术,
只要是使用Javascript 和 http Request来做到刷新网页的某个element

我用着ASP.NET和AJAX.Net的library,公司的内部程式。
很实用。

不过将要推出ASP.NET 2.0里,将会有类似的功能。
不用自己写AJAX的libary了。

现在无论GMail,Yahoo等都在积极使用社项技术在其各
网站里,在新版的MSN Hotmail里也会采用AJAX技术。

[ 本帖最后由 extrem23 于 15-10-2005 09:52 AM 编辑 ]
回复

使用道具 举报

发表于 15-10-2005 10:07 AM | 显示全部楼层
原帖由 撒旦的诅咒 于 15-10-2005 07:18 AM 发表
那要用Microsoft Visual Studio Dot Net来Edit吗?还是Notepad也可以?????

原帖由 红发 于 15-10-2005 09:19 AM 发表
很好的东西。

但是,是不是server也要support ajax才有用呢?


这里下载原码自己看
回复

使用道具 举报

发表于 15-10-2005 11:42 AM | 显示全部楼层
不过Output也需要用到InnerHTML等等 ,  如果是这样的话不如用IFrame代替, 处理资料都在Iframe里面做, 然后再用Javascript把资料传回来. Ajax还存在着一些Browser Compatible的问题, 例如Opera7还不能Support, 不过如果是用Iframe的话就没问题......
回复

使用道具 举报

发表于 15-10-2005 04:49 PM | 显示全部楼层
很不错的技术组合,在开源区非常出名。本人用开源的library叫做scriptjava的来使用AJAX,非常得不错!
在用户界面的处理上方便了很多。
回复

使用道具 举报

发表于 15-10-2005 05:32 PM | 显示全部楼层
发现他们通常都有用Layering的东西,  就是那些Windows...(可以Drag & Drop的) 如果最底层的页面有一个Dropdownlist的话情况会怎样? 因为在IE的话DropdownList都会Overlap所有的Layer.
回复

使用道具 举报

发表于 15-10-2005 08:19 PM | 显示全部楼层
我只是菜鸟一只
用了几天去了解如何运作

现在把我所了解的都献上了

希望可以在这里带来ajax的人气


据我所知
页面的处理是在client的电脑(javascript)
要资料才透过xmlhttprequest到server拿

这样可以减少网络的流量,服务器的utitlise


可以参考我们网络的著名gmail


或许可以留email
我可以send gmail的invitation给你

[ 本帖最后由 quantum^_^ 于 15-10-2005 08:32 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 30-10-2005 09:06 PM | 显示全部楼层
刚用了 ajax 做了我的fyp 网站。 觉得满好用的
只是觉得有点安全上的问题。

就放上来, 大家研究研究
http://farstarsg.no-ip.com/CSFreeWeb


username : cari_guest
password : cari_guest
寄放在我的电脑中, 速度不是很快, 希望大家原谅。
白天我应该都会开机.
回复

使用道具 举报

发表于 31-10-2005 08:10 AM | 显示全部楼层
原帖由 bluesea_520 于 30-10-2005 09:06 PM 发表
刚用了 ajax 做了我的fyp 网站。 觉得满好用的
只是觉得有点安全上的问题。

就放上来, 大家研究研究
http://farstarsg.no-ip.com/CSFreeWeb


usernam ...



你的也是用 .NET 的。请问有没有 php 或 jsp 的例子?
回复

使用道具 举报

发表于 31-10-2005 09:21 AM | 显示全部楼层
原帖由 belon_cfy 于 15-10-2005 05:32 PM 发表
发现他们通常都有用Layering的东西,  就是那些Windows...(可以Drag & Drop的) 如果最底层的页面有一个Dropdownlist的话情况会怎样? 因为在IE的话DropdownList都会Overlap所有的Layer.


dropdownlist 會蓋掉其他 layer 有方法可以解決, 但是有點麻煩...
回复

使用道具 举报

发表于 31-10-2005 02:08 PM | 显示全部楼层
目前还没有这样的能耐去研究AJAX,哈哈,不过为了先感受AJAX的功能,我正在试着xajax,PHP的AJAX Class Library,向先睹AJAX技术的PHPer可以玩玩看。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 29-3-2024 04:55 AM , Processed in 0.088012 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表