0

i have some question here.

i have a php script that request data from other web service.

but i need to request many data which i need to queue them all and wait one by one.

so i request that data using jquery (async), but the problem is, all data sorted by their loaded sequence.

so how to request them all by async, sorted them by price(for example like column 6) and serve them as table..

thank you for answer and suggestion..

so here's my code.

this is my table container

<table id="searchh" width="100%" border="0" cellpadding="10px" cellspacing="1px">
<tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
    <td>5</td>
    <td>6</td>
</tr>
</table>

i request new tr via this

$.get(request, function( my_var1 ) {
        $('#searchh>tbody>tr:last').after(my_var1);
        });

content of request is like this

<tr>
        <td>data</td>
        <td>data</td>
        <td>data</td>
        <td>data</td>
        <td>data</td>
        <td>random number</td>
    </tr>
Ryan Arief
  • 983
  • 2
  • 16
  • 36

1 Answers1

1

Here is the answer for your question,

in ajax after fetching data from server,trigger a click on price, like this,

$.get(request, function( my_var1 ) {
    $('#searchh>tbody>tr:last').after(my_var1);
    $("th#price").trigger( "click" );
});

dont forget to give id for th which has price, and trigger should be called after you fetch all records

Rest can be found in the working demo here.

Hope it helps you.

resource from here

Community
  • 1
  • 1
Niranjan N Raju
  • 12,047
  • 4
  • 22
  • 41