Hi there
I am trying to write a function which allows me to perform an ajax call dynamically, but am unsure how to make the key which is passed to the ajax call dynamic...
At the moment, my code is like this
$('#ajaxButton').click(function(){
var form = $(this).parent().find(':input');
var formVal = form.val();
var objectName = form.attr('id');
submitAjaxForm(formVal,objectName);
});
function submitAjaxForm(formVal,objectName){
data = {
objectName : formVal
}
// Ajax Call
$.post('handlers/' & objectName & '.cfc?method=save',data,function(){
}
});
Essentially, what I am trying to do, is pass a form fields value to a function that will process it, and then dynamically set the data key, and the handler.
Now I can dynamically set the handler using the objectName vaidable...but when I try and use this variable to set the data key, it doesnt like it..
I hope this makes sense..
Any ideas?
Thanks