javascript - jQuery AJAX and functions in a CFM file -
i have been searching 3 days , still cannot find proper answer question.
i apologize if question has been asked. please share me link proper answer.
question. possible use jquery ajax call functions in somefile.cfm (not .cfc)page?
my scenario follows:
i have lot of functions in somefile.cfm, 1 of them abc. trying following jquery code call function abc located @ somefile.cfm, index.cfm , response json string.
index.cfm
... $.ajax({ url: 'somefile.cfm', type: 'post', datatype: 'json', data: {method: abc. name: 'don'}, success: function(res){ alert(res); } }); somefile.cfm
<cffunction name="abc" returntype="any" returnformat="json"> <cfargument name="name" required="yes" type="string"> <cfset text['name'] = name> <cfset jsonvar = serializejson(text)> <cfreturn jsonvar> </cffunction> now when call, blank response. seems function not being called. not error.
it possible? or need convert page coldfusion component cfc file? please help. need expertise.
thanks.
you should use cfcs this
if reason can't above, need add cfscript block on cfm page call function. have case or if statement call abc function based off passed jquery. again, not recommended.
Comments
Post a Comment