I am trying to create an ajax function in my coldbox application,
following the Task Manager demo, but it doesnt seem to be functioning
for me..
Initially I am not sure whether I can call the function from my
external JS file? Because in the example the JS is hardcoded on the
page and uses cfsavecontent..
Regardless I have the following code in my external js file
function saveTask(){
$('.saveTask').click(function(){
// Hardcoded variables just as an example..
var sTitle = 'hello';
var iTaskListID = 1;
$.post('http://localhost:8501/toDoLists/index.cfm/tasks/save',
{sTitle:sTitle,iTaskListID:iTaskListID},function(data){
// Processing goes here
},"json")
});
}
And my tasks/save handler is based on the one in the Task Manager Demo
var rc = event.getCollection();
rc.task = taskService.getTask(event.getValue("taskID",""));
populateModel(rc.task);
taskService.save(rc.task);
This doesnt appear to be working for me, could anyone point me in the
right direction?
Many thanks
--
You received this message because you are subscribed to the Google Groups "ColdBox: A ColdFusion Framework" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For more information, visit http://www.luismajano.com/projects/coldbox
For Documentation, visit http://ortus.svnrepository.com/coldbox/trac.cgi
Thanks for the response..
Looks like im going about this the wrong way...
For the moment I dont really need to return any data, im just looking
to save info into the database..
However when I click on my link that calls the "save task" function it
doesnt work.....the post shows an error in firebug...it has no
specific details, it just flags it up in red.
I usually post directly to the method itself, like so
function saveTask(){
$('.saveTask').click(function(){
var sTitle = 'hello';
var iTaskListID = 1;
$.post('http://localhost:8501/toDoLists/model/taskService.cfc?
method=save',{sTitle:sTitle,iTaskListID:iTaskListID},function(data){
})
});
}
Which works, but I dont want to bypass the coldbox framework to
achieve what im doing.
I have tried add renderData, but its still bringing up an error in
firebug...
Thanks