Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It is not working, Actualy my code is below. As you can see I have two the same function. But in is inside ready with ajax the other is self function on ready. But the problem is: if I put the function inside done(function (data) { HERE } it isn't working. The main problem is that dataOut (global variable) I can't asc/desc in function sortResult. If wolud have for dataOut static arrays (show below) insted of data passed from php as json it would work fine. I don't get it why can't i edit my array, or wher is the problem.</p> <pre><code> var dataOut = [ { field_surname:'Sparow', field_name:'jack', field_date: '13.2.1988', field_timestamp: '31.9.2012 20:20:12' }, { field_surname: 'Pik', field_name:'Jany', field_date: '5. 10. 1978', field_timestamp: '31.9.2013 15:15:12' }, { field_surname: 'Micky', field_name:'mouse', field_date: '15. 7. 1978', field_timestamp: '31.9.2013 8:10:12' } ]; $(document).ready(function(){ $('#submit').click(function(event){ var phpScript="handle2.php"; $.getJSON (phpScript, { //tags:""; tagmode:"any", format:"json", }) .done(function (data){ dataOut = JSON.parse(JSON.stringify(data)); showResult(); }); $("#message").ajaxError(function(event, request, settings){ $(this).show(); $(this).append("&lt;li&gt;Error requesting page " + settings.url + "&lt;/li&gt;"); }); }); // $('#headings th').on('click', function(){ var id=$(this).attr('id'); //alert("id"+id); var asc =(!$(this).attr('asc')); $('#headings th').each(function () { $(this).removeAttr('asc'); }); if(asc) $(this).attr('asc','asc'); alert(asc); sortResult(id, asc); showResult(); }); }); </code></pre>
 

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