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 ...
随机推荐
- CSS中的float与clear
参考: http://www.cnblogs.com/iyangyuan/archive/2013/03/27/2983813.html http://www.cnblogs.com/iloveyou ...
- gitlab 无法查看提交的文件Errno::ENOMEM (Cannot allocate memory - /opt/gitlab/embedded/bin/git):
gitlab可以成功clone和push,但是提交后的文件却无法查看.从页面上看的话只显示出500错误. 查了下gitlab的日志 tail -f /var/log/gitlab/gitlab-rai ...
- hdu3652
基本的数位dp,需要记录前面除以13的余数. #include <cstdio> #include <cstring> using namespace std; #define ...
- ios中的RunLoop 和 android 中的Looper
今天写android程序,用到了Handler,晚上回来查阅资料,发现了Looper这个概念. 看了一下网上关于Looper的资料,发现这个Looper跟ios中的Runloop基本的理念完全一致! ...
- [第三方]SDWebImage获取网络图片控件的用法
#import "UIImageView+WebCache.h" @interface WeatherViewController ()<UISearchBarDelegat ...
- JSP公用COMMON文件
head.jsp: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" ...
- 【leetcode】Binary Tree Preorder Traversal (middle)★
Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tr ...
- UVA 11827 Maximum GCD
F - Maximum GCD Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Given the ...
- 无限轮播的N+2 策略
N张照片把contentsSize设置为N+2个图片的宽度,例子如下,两端填充如图,当处于一端时,且即将进入循环状态的时候,如第二张图,从状态1滑动到状态2,在滑动结束的时候,将当前的位置直接转到状态 ...
- iOS学习资源个人整理
1208更新: http://www.tuyiyi.com 图翼网 https://github.com/Alamofire/Al ...