How to use Ajax on Visualforce page on Salesforce platform
2019-07-23 01:56
169 查看
原文链接:https://www.geek-share.com/detail/2593581260.html
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 : https://www.geek-share.com/detail/2597212280.html
转载于:https://www.cnblogs.com/mingmingruyuedlut/p/3385532.html
相关文章推荐
- How to use Ajax on Visualforce page on Salesforce platform
- A ScriptManager is required on the page to use ASP.NET AJAX Script Components
- How to deploy a .Net assmebly for COM use through CAB on Web Page (转)
- How To Create a Custom Salesforce Communities Login and Landing Page
- How To Use RMAN CONVERT DATABASE on Source Host for Cross Platform Migration
- An example on how to use jQuery and Ajax.NET Professional together
- How to use HttpWebRequest to post data to another page which is on another server
- Required red Mark on a visualforce page -自定义字段如何必填标红
- Note On <Programming Entity Framework 2nd Edition> -01: How to Use LINQPad 4.5
- How To Use MySQL with Your Ruby on Rails Application on Ubuntu 14.04
- 在Visualforce page中用自带的控件实现Ajax回调后台方法(并且可以用js去动态给parameters赋值)
- How to use an ASP.NET application to query an Indexing Service catalog by using Visual Basic .NET
- How to Load XML with JavaScript on an HTML5 Page
- example of using ajax in VisualForce page
- [ios] how to findout the language you use on ios devices.
- How to use the System Restore API to save and to restore system data in Visual C++
- Ubuntu 14.04安装PostgreSQL How To Install and Use PostgreSQL on Ubuntu 14.04
- How to use jquery or ajax to update razor partial view in c#/asp.net for a MVC project
- How to Configure, Install and Use libnefilter_queue on Linux
- How to Capture the Row Selected on Search Page In a Variable?