I have a form which has a lot of attributes.
One of them is a callback, which contains the of the callback function what I want to call.
<form id="placeOrder" method="post" class="ajax" popupclass="order-created" callback="orderCreated" action="url" >
and the JS part is:
function popupHandler(sender){
var popupclass = $(sender).attr('popupclass');
var callback = $(sender).attr('callback');
if ((typeof popupclass== "undefined") )
{
$("#pageContent").clickPopup('saved');
}
else
{
if ((typeof callback!= "undefined") )
{
//TODO: call the function , function name is in callback attr
}
$("#pageContent").clickPopup(popupclass);
}
}
function orderCreated(){
$('#basketquantity').html('0');
$('#placeOrderButton').disableButton();
}
I have checked this page , but the name of the functions are predefined there , so that is not suitable for me.