I have a custom button on Quote standard detail page which on Click opens up a Jquery dialogue box containing an iframe with src as a visualforce page(rendered as pdf) and contains two Button "save" and "Save and Email". a)Is it possible call a Apex class method when we click on these button, if yes how can we achieve this. b)If No, how can we achieve this with any other approach.
Here is the code for the javascript Custom button :-
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js')}
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js')}
var j$ = jQuery.noConflict();
var iframe_url = '/apex/CustomVisualforcePageRenderedAsPdf';
var j$modalDialog = j$('<div></div>')
.html('<iframe id="iframeContentId" src="' + iframe_url + '" frameborder="0" scrolling="auto" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="no" />')
.dialog({
autoOpen: false,
title: 'Support Merge Fields',
resizable: false,
width: 700,
height: 300,
autoResize: true,
modal: true,
draggable: false,
buttons: [
{
text: "Save",
click: j$.noop,
type: "submit"
},
{
text: "Save And Email",
click: function() {
j$( this ).dialog( "close" );
}
}
]
});
j$modalDialog.dialog('open');