I think that you could probably do something like this:

//first get
 $.ajax({
   type: "GET",
   url: "some.php",
   data: "name=John&location=Boston",
   success: function(){
     //another get on success
      $.ajax({
       type: "GET",
       url: "somepage2.php",
       data:"what=whatever",
       success: function(){
       //do whatever here
       }
      });
   }
 });

Basically what I did there was put the second get inside of the first
get. It will only run after the first get was successful. Please let
me know if you need any more help.

On Oct 10, 5:07 pm, James W <proje...@jingsoftware.com> wrote:
> Hello,
>
> I have a page that makes two ajax calls when the function is called. I
> have noticed while testing the page that sometimes the second request
> does not run, the first request works but then sometimes the second
> ones gets skipped.
>
> Is there a way to make sure the second request fires only after the
> first one?
>
> Here is my code below:
>
> <script type="text/javascript">
>
> function InsertOrder(id,tbl) {
> $.ajaxSetup({dataType: "html"})
>
> $.get('demo_orders.asp?PID=' + id + '&TBL=' + tbl,function(datanew) {$
> ('#pos-diner-left-mid').empty();$('#pos-diner-left-mid').append
> (datanew);})
>
> $.get('order_total.asp?TBL='  + tbl, function(datanew){$('#pos-header-
> total').empty();$('#pos-header-total').append(datanew);})
>
> }
>
> </script>
>
> Thanks
>
> James

Reply via email to