gsr
09/05/2022, 2:38 PMFIELDNAMES 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 itAdam Cameron
gsr
09/05/2022, 2:56 PMgsr
09/05/2022, 2:56 PMaliaspooryorik
gsr
09/05/2022, 3:38 PMvar 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 questiongsr
09/05/2022, 3:39 PMaliaspooryorik
aliaspooryorik
tablesLists.push ( $(this).val() );
this is appending to an array so tableLists is an array not a listaliaspooryorik
myArray.join(',')
in Javascriptgsr
09/05/2022, 4:35 PMgsr
09/05/2022, 4:35 PMaliaspooryorik
join
converts an javascript array to a string. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join