How to use Ajax on Visualforce page on Salesforce platform
Just use Ajax pattern to call object data from server on visualforce page.
Following is the Asynchronise demo:
<apex:page >
<script type="text/javascript">
var __sfdcSessionId = '{!GETSESSIONID()}';
</script> <script src="../../soap/ajax/29.0/connection.js" type="text/javascript"></script> <script type="text/javascript">
window.onload = setupPage;
function setupPage(){
var state = {
output : document.getElementById("output"),
startTime : new Date().getTime()
}; var callBack = {
onSuccess : layoutResults,
onFailure : queryFailed,
source : state
}; sforce.connection.query("Select Id, Name, Industry From Account order by Industry", callBack);
} function queryFailed(error, source){
source.output.innerHTML="An error has occurred: " + error;
} function layoutResults(queryResult, source){
if(queryResult.size > 0){
var output = "";
var records = queryResult.getArray('records');
for(var i = 0; i < records.length; i++){
var account = records[i];
output += account.Id + " " + account.Name + " [Industry - " + account.Industry + "]<br>";
}
source.output.innerHTML = output;
}
} </script> <div id="output"></div> </apex:page>
If we want to use the Synchronise model. Just use the query function without callback. Following is the demo code.
sforce.connection.query("Select Id, Name, Industry From Account order by Industry")
If you want to know more about the detail. Please go to click this link: http://www.salesforce.com/us/developer/docs/ajax/apex_ajax.pdf
...................................
Another link show you another ajax call code-behind function : http://www.cnblogs.com/mingmingruyuedlut/p/3450753.html
How to use Ajax on Visualforce page on Salesforce platform的更多相关文章
- Salesforce学习之路-developer篇(三)利用Visualforce Page实现页面的动态刷新案例学习
Visualforce是一个Web开发框架,允许开发人员构建可以在Lightning平台上本地托管的自定义用户界面.其框架包含:前端的界面设计,使用的类似于HTML的标记语言:以及后端的控制器,使用类 ...
- Salesforce学习之路(六)利用Visualforce Page实现页面的动态刷新功能
Visualforce是一个Web开发框架,允许开发人员构建可以在Lightning平台上本地托管的自定义用户界面.其框架包含:前端的界面设计,使用的类似于HTML的标记语言:以及后端的控制器,使用类 ...
- 在Salesforce中向Page Layout中添加Visualforce Page
在Salesforce中可以向Object所对应的Layout中添加我们自定义的Visualforce Page. 此时的Visualforce Page与Asp.Net MVC中的Partial V ...
- Salesforce随笔: 将Visualforce Page渲染为PDF文件(Render a Visualforce Page as a PDF File)
参照 : Visualforce Developer Guide 第60页 <Render a Visualforce Page as a PDF File> 你可以用PDF渲染服务生成一 ...
- Visualforce Page CSS样式
Salesforce Page开发者文档:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_stylin ...
- Visualforce Page超链接
Salesforce开发者文档:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start ...
- 在Visualforce page中用自带的控件实现Ajax回调后台方法(并且可以用js去动态给parameters赋值)
这里用的组合是:apex:commandLink + apex:actionFunction + apex:outputPanel 这里的 apex:commandLink 和 apex:actio ...
- Salesforce随笔: 将Visualforce Page导出为 Excel/CSV/txt (Display a page in Excel)
想要实现如题所述功能,可以参照 : Visualforce Developer Guide 第57页中所举的例子,在<apex:page>标签中添加contentType属性. <a ...
- Ajax load html page
jQuery ajax - load() 方法 jQuery Ajax 参考手册 实例 使用 AJAX 请求来改变 div 元素的文本: $("button").click(fun ...
随机推荐
- diff & pattch 命令
基础知识 该命令的功能为逐行比较两个文本文件,列出其不同之处.它比comm命令完成更复杂的检查.它对给出的文件进行系统的检查,并显示出两个文件中所有不同的行,不要求事先对文件进行排序. 语法:diff ...
- C#关于new的用法
1.运算符就是在实例化一个类的时候(运算符的用法) A a=new A(); 2.new 约束指定泛型类声明中的任何类型参数都必须有公共无参数构造函数.当泛型类创建类型的新实例时,将此约束应用于类型参 ...
- Base64编码格式详解
什么是Base64? 按照RFC2045的定义,Base64被定义为:Base64内容传送编码被设计用来把任意序列的8位字节描述为一种不易被人直接识别的形式.(The Base64 Content-T ...
- 自定义tld标签,页面使用
背景需求: 系统本身的session不能在页面使用 如下: controller: @RequestMapping(method=RequestMethod.GET) public String ge ...
- 【python】类变量和对象变量
来源:http://www.cnblogs.com/gtarcoder/p/5005897.html python是一种解释性的语言,任何变量可以在使用的时候才声明以及定义,也可以在程序运行的任何位置 ...
- 【linux】sudo su切换到root权限
在用户有sudo权限但不知道root密码时可用 sudo su切换到root用户
- 查看Linux内核
方法一: 命令: uname -a 作用: 查看系统内核版本号及系统名称 方法二: 命令: cat /proc/version 作用: 查看目录"/proc"下version的信息 ...
- supersr--时间显示逻辑-->NSDate+NSCalendar
一种:时间逻辑: - (NSString *)created_at{ // 从后台返回的字符串格式:Mon Aug 03 09:17:31 +0800 2014, //NSDateFormatt ...
- timestamp 类型的索引
由这条语句datetime.strftime('2014/12/05','%Y/%m/%d')转换出来的索引 是pandas内置类型相同,如果使用datetime.strftime('2014/12/ ...
- Oracle读写分离架构
读写分离是架构分布式系统的一个重要思想.不少系统整体处理能力并不能同业务的增长保持同步,因此势必会带来瓶颈,单纯的升级硬件并不能一劳永逸.针对业务类型特点,需要从架构模式上进行一系列的调整,比如业务模 ...