How to retrieve data before window unload

How to retrieve data before window unload

ratm54ratm54 Posts: 9Questions: 0Answers: 0
edited March 2011 in General
Hello,
I use dataTable 1.7.6 with jeditable.
I want to retrieve the data with fnGetData() before the window unload.
I tried :
[code]
$(window).unload(function() {
var sTab = $(oTable.fnGetData()).serializeArray().getJSON();
alert(sTab);
$('#iptAddMajMember').val(sTab);
});
[/code]
but oTable.fnGetData() is empty.

Thanks in advance.

Replies

  • ratm54ratm54 Posts: 9Questions: 0Answers: 0
    The solution (with jquery and json2.js).
    In the click event function of input submit, I convert data on json and put into the value of input html element.
    [code]
    $("#iptMajMembreCesc").click(function() {
    var sTab = JSON.stringify(oTable.fnGetData());
    $('#iptAddMajMember').val(sTab);
    return $('#iptAddMajMember').submit();
    });
    [/code]
This discussion has been closed.