Copy link to clipboard
Copied
I create a cfc which has one method and want to access from cfm file using jQuery.
it seems that jQuery does not recognize the component,\
I remember that I can check if this component and method is accessible from my browser, but I do not remember how.
Your help and information is great appreciated,
Regards,
Sourises,
You can test the component by navigating to http://mysite.com:port/MyCFC.cfc?method=myMethod
Change the above URL to meet you environment. For instance it might be something like http://localhost:8500/model/remoting.cfc?method=login
As a quick aside, make sure you have set the CFC access to "remote".
Copy link to clipboard
Copied
You can test the component by navigating to http://mysite.com:port/MyCFC.cfc?method=myMethod
Change the above URL to meet you environment. For instance it might be something like http://localhost:8500/model/remoting.cfc?method=login
As a quick aside, make sure you have set the CFC access to "remote".
Copy link to clipboard
Copied
If you are using a form to submit via AJaX to a CFC:
$('#submitBtn').on('click', function(e){
e.preventDefault(); // prevents form from standard submit
var $formData = $('#formName').serializeArray(); // Since this is submitting via AJaX, the submit button will not be included in the form scope
var $urlData = "//www.domain.com/components/myCFC.cfc?method=myFunction"; //As nic pointed out, change this to fit your environment
$.ajax(
url: $urlData,
data: $formData
)
.done(
// Process code for successful action
);
});
This is what I typically use. Different scenarios have different settings.
HTH,
^_^
Copy link to clipboard
Copied
Thanks a million for helping and information,
Regards,
Sourises,