Ajax call in ModelGlue without rendering a view
Hi All,
I am using Ajax with ModelGlue. I want to make an Ajax call to return a value. I do not want to render any view. I just want a database interaction and bring back a value.
My Ajax call:
new Ajax.Request(root+'test.testFunction',{
method: 'post',
parameters: {param1:paramval},
onSuccess: function(response){
alert(response.responseText);
var myresult = response.responseText;
}
})
my modelglue event :
<event-handler name="test.testFunction">
<broadcasts>
<message name="testFunction" />
</broadcasts>
</event-handler>
and my controller function:
<cffunction name="testFunction" returnType="any" output="true" >
<cfargument name="event" type="any" required="true">
<cfset justtest = 1>
<cfreturn justtest>
</cffunction>
I am using prootype as my ajax library.
I want to have myresult value as 1 according to the above scenario.
Pls help. Thnx for any help.
