I have this function:
$('#new').live('click', addRecord);
function addRecord() {
var data = $('#add').serialize();
$.ajax({
type: "post",
url: "/manage/add",
data: data,
dataType: 'json',
success: function(response){
if (response.status === true) {
alert(response.status);
});
} else {
alert(response.status);
}
}
});
}
So it works fine but I have this in 5 pages on the site and was wondering
how can I turn this into a standard function and call it like:
addRecord(form_id);
So I only need to place this on the page rather thanthe same script all over
the site.
Thanks
Dave