You need to sign in to do that
Don't have an account?
Scott McArthur 8
jquery in Lightning components
Does anyone have any examples of how to make a jQuery get from a Lightning component using code similar to the below where the data will be returned from SOQL query in Salesforce
jQuery.ajax({
url: '/MCS/GetCar',
type: "GET",
dataType: "json",
I am already aware of how to import the jquery library using '<ltng:require' and creating an @AuraEnabled method in Apex but it was wiring the rest together I was unsure about, I am relatively new to Lightning although aware of the basics.
jQuery.ajax({
url: '/MCS/GetCar',
type: "GET",
dataType: "json",
I am already aware of how to import the jquery library using '<ltng:require' and creating an @AuraEnabled method in Apex but it was wiring the rest together I was unsure about, I am relatively new to Lightning although aware of the basics.
I am not sure why you want to use Jquery to call your apex controller , but you can use javascript if you want
you can write this in your js controller::
methodName:function(component,event,helper){
// Calling Apex Controller
var action = component.get("c.apexControllerMethodName");
action.setParams({
"parameter":value you wanto pass
});
action.setCallback(this,function(response){
var state = response.getState();
if(state == "SUCCESS"){
// do your stuff
}else{
console.log("Failed with state: " + state);
}
});
$A.enqueueAction(action);
}