i read this article https://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting.htm
there are two examples given
<script type="text/javascript">
function sayHello(helloTo) {
ChildRemoteController.sayHello(helloTo, function(result, event){
if(event.status) {
document.getElementById("result").innerHTML = result;
}
});
}
</script>
and
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.RemoteController.setMessage}',
{'apexType':'thenamespace.RemoteController.MyClass', 'myString':'Lumos!'},
handleResult
);
in annotation 2 every thing is fine i can call apex function but in annotation 1.i have
function clickHandler(){
console.log('--coming here---');
var x= $('#searchAskInputContainer').val();
$('#article-section').appendChild() ;
SampleController.getArticleVersions(x,function(result){
console.log('coming here');
});
}
and in apex side
public with sharing class SampleController {
@RemoteAction
public static List<KnowledgeArticleVersion> getArticleVersions(String firstParam){
System.debug('first param is'+firstParam);
List<List<KnowledgeArticleVersion>> kav = [FIND :firstParam IN ALL FIELDS RETURNING KnowledgeArticleVersion (Id Where language='en_US' AND PublishStatus='Online')] ;
return kav[0];
}
}
when i call SampleController.getArticleVersion its giving me error
Uncaught TypeError: undefined is not a function
please tell why its not working when i directly use it ??