I've got a lot of hard coded values in JQuery functions like the one below
$("#getTOByWeek").live("click", function(){
$.ajax({
type:"post",
url:"webapps/hr/admin/actions/act_adminHR_Handler.cfm",
data:$("#toByWeek").serialize(),
cache:"false",
success: function(){
$("#content-box").load("webapps/hr/admin/display/dsp_TOList.cfm");
},
error: function(){
alert("data");
}
});
return false;
});
I use this chunk of code repeatedly, changing the button name, form name,
url loading div name, and the page that's loaded
(#getTOByWeek, /hr/admin/actions/act_adminHR_Handler.cfm, #toByWeek,
#content-box, /hr/admin/display/dsp_TOList.cfm respectively in this case)
What I'd like to be able to do is have one code chunk that I throw variables
at, instead of cutting/pasting and changing the hard coded values it would
be much more elegant and make troubleshooting a lot easier. Not to mention
making my .js file a helluva lot smaller.
Any thoughts on how to do this?
Thanks
sas
--
Scott Stewart
IT Consultant/ColdFusion Developer
4405 Oakshyre Way
Raleigh, NC 27616
(919) 874-6229