You need to sign in to do that
Don't have an account?
Nirmal Christopher
Trouble with JQuery Streaming API?
The below code is not working for me. I was testing the code which is given from the saleforce blogs. The streaming api Doesnt working can any one tell me what i am missing here?
<apex:page id="page" tabStyle="Case">
<apex:includeScript value="{!$Resource.cometd}"/>
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:includeScript value="{!$Resource.json2}"/>
<apex:includeScript value="{!$Resource.jquery_cometd}"/>
<script type="text/javascript">
var j$ = jQuery.noConflict();
j$(document).ready(function() {
j$.cometd.init({
url: window.location.protocol+'//'+window.location.hostname+'/cometd/28.0/',
requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
});
j$.cometd.subscribe('/topic/CaseNotifications’, function(message) {
document.getElementById('{!$Component.page.block.casenumber}').innerText = message.data.sobject.CaseNumber;
document.getElementById('{!$Component.page.block.casestatus}').innerText = message.data.sobject.Status;
document.getElementById('{!$Component.page.block.casepriority}').innerText = message.data.sobject.Priority;
console.log(message);
});
});
</script>
<apex:sectionHeader title="Simple" subTitle="Case Notifications"/>
<apex:pageBlock id="block">
<apex:panelGrid columns="2">
<apex:outputLabel value="Case Number: "
for="casenumber" style="font-weight: bold;"/>
<apex:outputText value="" id="casenumber"/>
<apex:outputLabel value="Case Status: "
for="casestatus" style="font-weight: bold;"/>
<apex:outputText value="" id="casestatus"/>
<apex:outputLabel value="Case Priority: "
for="casepriority" style="font-weight: bold;"/>
<apex:outputText value="" id="casepriority"/>
</apex:panelGrid>
</apex:pageBlock>
</apex:page>
http://wiki.developerforce.com/page/Streaming_Real_Time_Data_into_Visualforce?app_data=%7B%22pi%22%3A%22532112ed9b6f688114000003%22%2C%22pt%22%3A%22wall%22%7D
This is the link for the blog.
<apex:page id="page" tabStyle="Case">
<apex:includeScript value="{!$Resource.cometd}"/>
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:includeScript value="{!$Resource.json2}"/>
<apex:includeScript value="{!$Resource.jquery_cometd}"/>
<script type="text/javascript">
var j$ = jQuery.noConflict();
j$(document).ready(function() {
j$.cometd.init({
url: window.location.protocol+'//'+window.location.hostname+'/cometd/28.0/',
requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
});
j$.cometd.subscribe('/topic/CaseNotifications’, function(message) {
document.getElementById('{!$Component.page.block.casenumber}').innerText = message.data.sobject.CaseNumber;
document.getElementById('{!$Component.page.block.casestatus}').innerText = message.data.sobject.Status;
document.getElementById('{!$Component.page.block.casepriority}').innerText = message.data.sobject.Priority;
console.log(message);
});
});
</script>
<apex:sectionHeader title="Simple" subTitle="Case Notifications"/>
<apex:pageBlock id="block">
<apex:panelGrid columns="2">
<apex:outputLabel value="Case Number: "
for="casenumber" style="font-weight: bold;"/>
<apex:outputText value="" id="casenumber"/>
<apex:outputLabel value="Case Status: "
for="casestatus" style="font-weight: bold;"/>
<apex:outputText value="" id="casestatus"/>
<apex:outputLabel value="Case Priority: "
for="casepriority" style="font-weight: bold;"/>
<apex:outputText value="" id="casepriority"/>
</apex:panelGrid>
</apex:pageBlock>
</apex:page>
http://wiki.developerforce.com/page/Streaming_Real_Time_Data_into_Visualforce?app_data=%7B%22pi%22%3A%22532112ed9b6f688114000003%22%2C%22pt%22%3A%22wall%22%7D
This is the link for the blog.
bob_buzzard
Do you see any javascript errors in the console/inspector?