Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

coldfusion - variable not being passed on when making a call through cfajaxproxy to a cffunction

function getStateInfo(state){
  alert(state);
  var f = new funcs();
  f.setCallbackHandler(updateFormFieldStateInfo);
  f.setQueryFormat('column');
  f.qry_getLenderEvictionStateInfo(<cfoutput>#request.Lender_Id#</cfoutput>,state);
}

doesn't pass the state value to the ColdFusion function

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here are a few observations that may help:

Is the alert() function defined in your prior code or is it being confused with javascript's alert() function? I don't believe that Coldfusion has a built in alert() function unless it's new in version 9.

A caution, not a problem, the var keyword must be defined at the very top of the function body unless you are using Coldfusion 9. Likewise, the "new" keyword is new to CF 9. I'm guessing you're on version 9 since you're using both features.

For pre-Coldfusion 9:

function getStateInfo(state){
    var f = createobject("component","functs");
    alert(state);
    ...

Don't put the tags within cfscript. You don't need the hash marks either, although they won't cause harm. Hash marks are intended for use outside of coldfusion tags (including cfscript), in the main body of the html.

This line:

 f.qry_getLenderEvictionStateInfo(<cfoutput>#request.Lender_Id#</cfoutput>,state);

Should be:

 f.qry_getLenderEvictionStateInfo(request.Lender_Id,state);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...