I am having a little fun and working with the Streaming API. It was working fine yesterday, and I was able to subscribe without any issues. However, now I am getting this error:
Cannot read property 'init' of undefined
I am pretty certain I have not changed any of the code and the static resources that are being called definitely have not been edited or changed. I even as a precautionary measure updated them again before posting this.
JQuery:
$(function () {
$("#finalise").click(function () {
$.cometd.init({
url: window.location.protocol + '//' + window.location.hostname + '/cometd/24.0/',
requestHeaders: {
Authorization: 'OAuth {!$Api.Session_ID}'
}
});
});
});
This should basically initialise the connection on click of a button that I have on my page.
I am absolutely baffled at this, especially with me being new to JQuery :/
Any help would be very largely appreciated!
$.cometdis undefined. I suggest you check the "Network" tab of your browser's "Developer Tools" to ensure that both the jQuery and CometD JavaScript was found and then also check for any errors in the JavaScript console. This may help. – Keith C Jul 22 '15 at 20:32