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‘)”的问题
364 0
|
虚拟化
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
|
自然语言处理
Reading the Manual: Event Extraction as Definition Comprehension, EMNLP 2020
Reading the Manual: Event Extraction as Definition Comprehension, EMNLP 2020
91 0
Reading the Manual: Event Extraction as Definition Comprehension, EMNLP 2020
|
数据可视化 数据挖掘 开发者
Data-Basic Statistical Descriptions of Data| 学习笔记
快速学习 Data-Basic Statistical Descriptions of Data。
Data-Basic Statistical Descriptions of Data| 学习笔记
|
SQL 关系型数据库 RDS
9 Easy Steps for Successful Data Migration
Migrate your database without service interruptions with Alibaba Cloud Data Transmission Service
1987 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.
1310 0
Speed Matters: How To Process Big Data Securely For Real-time Applications
|
传感器 关系型数据库 PostgreSQL
Real-time Monitoring and Alerts for Senior Citizens - Big Data for Healthcare
This article discusses Alibaba Cloud PostgreSQL best practices for healthcare applications. In particular, we will explore how Big Data can be applied.
2513 0
Real-time Monitoring and Alerts for Senior Citizens - Big Data for Healthcare