views:

22

answers:

1
function exporttoexcel() {

    $('#export').click(function() {

        $.ajax({
            url: 'exportdata.aspx',
            cache: false,
            success: function(data) {

            }

        });

    });

}

I want to export datagrid item into excel file. when i use aler(data). item is displaying but excel save as and download window is not appearing.

+1  A: 

You can't use ajax for this purpose. Just open the url in new window.

function exporttoexcel() {
    $('#export').click(function() {
         window.open('exportdata.aspx');
    });
}
Teja Kantamneni
Thanks Teja, Its working...
pradeeptamar
Glad I can help you
Teja Kantamneni