Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling a serverside method in a javascript function?
    text
    copied!<p>Here i am calling a javascript function on a button click and i need to call the server side method inside the javascript function after finishing its execution.</p> <p><strong>Javascript Function</strong></p> <pre><code> function exportCharts(exportFormat) { initiateExport = true; for (var chartRef in FusionCharts.items) { if (FusionCharts.items[chartRef].exportChart) { document.getElementById("linkToExportedFile").innerHTML = "Exporting..."; FusionCharts.items[chartRef].exportChart({ "exportFormat": exportFormat }); } else { document.getElementById("linkToExportedFile").innerHTML = "Please wait till the chart completes rendering..."; } } } </code></pre> <p><strong>Server side Method</strong></p> <pre><code> protected void imgBTNExportPPT_Click(object sender, ImageClickEventArgs e) { try { PredictExportToPPT objOExporttoPPT = new PredictExportToPPT(); PredictionModel(); string reportNames = ObjCommon.GetBIReportNames("Prediction", "Report"); reportNames += ObjCommon.GetBIReportNames("Prediction", "Table"); objOExporttoPPT.ExportToPPTPredict(ObjPredictInputParameter, reportNames, ObjSharedEntities.PredictTableData); string itemname = "PPTOutput.pptx"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "pptx"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + itemname + ""); HttpContext.Current.Response.BinaryWrite(System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath(DataTemplate.PPTOutputTemplateFilePath))); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } catch (Exception exceptionMessage) { throw (exceptionMessage); } finally { GC.Collect(); } } </code></pre> <p>and i have tried like this </p> <pre><code> $(document).ready(function () { $("#imgBTNExportPPT").click(function (e) { e.imgBTNExportPPT_Click(); $.ajax({ type: "POST", url: "PEventPerformance.aspx/updateContent", data: "{}", success: function (result) { } }); }); }); </code></pre> <p>Any suggestion??</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload