• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

access cfc component

Engaged ,
Mar 30, 2016 Mar 30, 2016

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,

TOPICS
Getting started

Views

637

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Mar 30, 2016 Mar 30, 2016

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".

Votes

Translate

Translate
Engaged ,
Mar 30, 2016 Mar 30, 2016

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".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 31, 2016 Mar 31, 2016

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,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 31, 2016 Mar 31, 2016

Copy link to clipboard

Copied

LATEST

Thanks a million for helping and information,

Regards,

Sourises,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation