5.1. Instructions Instead of Data

简介:

5.1. Instructions Instead of Data

Rails 解决Ajax请求的方式是返回JavaScript指令,而不是HTML代码。执行返回的Javascript指令,也就是执行加入到页面的脚本,可以用来创建视觉效果,调用指定的外部javascript资源库中的方法。你也可以加入在一个请求中可能用到的JavaScript声明。所以这让你可以很轻松的完成页面元素的更新。尝试使用像标准一样的link_to_remote :update=>…helper你会很快感觉到JavaScript的价值之所在。

 

Ajax应用中,服务器似乎被加入了客户端逻辑层,成了提供数据的角色。当然,对Ajax请求返回Javascript指令这种做法,它并不能概括出Rails真正的特点,因为任何语言或者是框架都可能做到这点。那么Raisl真正区别于其他框架之处在哪呢?那就是:如何创建Javascript指令。




本文转自 fsjoy1983 51CTO博客,原文链接:http://blog.51cto.com/fsjoy/91842,如需转载请自行联系原作者
目录
相关文章
“Could not find suitable distribution for Requirement.parse(‘XXXX‘)”的问题
“Could not find suitable distribution for Requirement.parse(‘XXXX‘)”的问题
390 0
|
机器学习/深度学习 自然语言处理 测试技术
Query and Extract Refining Event Extraction as Type-oriented Binary Decoding 论文解读
事件抽取通常被建模为一个多分类问题,其中事件类型和论元角色被视为原子符号。这些方法通常仅限于一组预定义的类型。
75 0
|
数据可视化 数据挖掘 开发者
Data-Basic Statistical Descriptions of Data| 学习笔记
快速学习 Data-Basic Statistical Descriptions of Data。
Data-Basic Statistical Descriptions of Data| 学习笔记
Data Structures and Algorithms (English) - 7-8 File Transfer(25 分)
Data Structures and Algorithms (English) - 7-8 File Transfer(25 分)
112 0
Data Structures and Algorithms (English) - 7-10 Saving James Bond - Easy Version(25 分)
Data Structures and Algorithms (English) - 7-10 Saving James Bond - Easy Version(25 分)
97 0
Data Structures and Algorithms (English) - 6-14 Count Connected Components(20 分)
Data Structures and Algorithms (English) - 6-14 Count Connected Components(20 分)
145 0
Data Structures and Algorithms (English) - 6-2 Two Stacks In One Array(20 分)
Data Structures and Algorithms (English) - 6-2 Two Stacks In One Array(20 分)
145 0
The Rising Smart Logistics Industry: How to Use Big Data to Improve Efficiency and Save Costs
This whitepaper will examine Alibaba Cloud’s Cainiao smart logistics cloud and Big Data powered platform and the underlying strategies used to optimiz.
1548 0
The Rising Smart Logistics Industry: How to Use Big Data to Improve Efficiency and Save Costs
|
SQL 关系型数据库 RDS
9 Easy Steps for Successful Data Migration
Migrate your database without service interruptions with Alibaba Cloud Data Transmission Service
1993 0
9 Easy Steps for Successful Data Migration
|
容器 安全 物联网
Speed Matters: How To Process Big Data Securely For Real-time Applications
Big Data processing has stepped up to provide organizations with new tools and technologies to improve business efficiency and competitive advantage.
1314 0
Speed Matters: How To Process Big Data Securely For Real-time Applications

热门文章

最新文章