I am new in json. I generated jason data from mysql table using php and want to export the generated json to .xls format.
examexport.php
In your examexport.php, change $_POST to $_GET and use the following function:
<input type="button" onclick="exportExcel()" value="Export to Excel " />
<script>
function exportExcel() {
var row=$('#dg').datagrid('getData');//to get the loaded data
if (row) {
url = "excel/examexport.php?entry="+$('#entry').val()+"&
semester="+$('#semester').val()+"&batch="+$('#batch').val();
window.open(url);
}
}
</script>
For final word, please go through http://www.jeasyui.com/documentation/index.php. they have good documentation.
$("#btnExport").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#dg').html()));
e.preventDefault(); });
you can use just simple jquery code. you should add jquery library on your file.