i want to pass the following to the cfc but i am g...
# cfml-general
g
i want to pass the following to the cfc but i am getting an error
Copy code
FIELDNAMES TABLESLISTS[]
TABLESLISTS[] dbo.projects
old code is passing the value from ajax by declaring a array object and then push it to the call as {TABLESLISTS : TABLESLISTS} i wonder how to fix it
a
I wonder how you think anyone would be able to respond sensibly to this?
g
i do not know what you are expecting, so leave it if not understood Thanks
and its not my code
a
Well, maybe tell us what the error actually is would be a good start
g
Yes, Here is how it is happening
Copy code
var tablesLists = [];
    $("select").each(function(){ 
        var id = $(this).attr("id");
        var value = $(this).val();
        if ( id == 'fromModel' && value != null) {
            var value = $(this).val();
            if ( value.length > 0 ) {
                tablesLists.push ( $(this).val() );
            }
        }
    });

    fields = [];
    console.log( "tables lists ->" + tablesLists)
    if ( tablesLists.length > 0 ) {
    $.ajax({ 
        type: 'POST',
        url: "/myrcfc.cfm?object=fields",
        data: JSON.stringify(tablesLists),
        dataType: "json",
        success: function(parsedData){ 

		var response = JSON.parse(parsedData);
    }
    });
    }
the above JS code is sending the form data as i stated above in my first post of question
it should the data as comma seperated but not sure why it is sending the fieldnames as; tableLists[]
a
OK. So that is posting to a .cfm file not a .cfc as you mentioned originally.
tablesLists.push ( $(this).val() );
this is appending to an array so tableLists is an array not a list
You could convert the array to a list by doing something like
myArray.join(',')
in Javascript
g
ok, let me try that
instead of doing a push right
a