0

I am developing a script using GreaseMonkey (with jQuery/AJAX included) for the ServiceNow CMS. This script is used to get the number of incidents using the filter option ServiceNow provide to technicians using AJAX. This part is currently working.

However, I am encountering a situation I cannot overcome. My script is making an AJAX call on a page (called sys_report_template.do), but this same page is making another AJAX call to a page that I cannot find even after 2 hours of research.

I wonder if there is a way to wait for the AJAX call made by the sys_report_template.do to finish to query the final DOM on my AJAX Call.

I saw the ajaxComplete() handler and the shorthand methods, load() in the jQuery API but I don't think this is what I am searching for. Maybe I'm wrong. Any ideas?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
P. Jerome
  • 283
  • 1
  • 4
  • 13

1 Answers1

0

you can call ajax in ajax success if it's what you are looking for :

    $.ajax({
    type : "POST",
    url : yourUrl,
    data:  yourData,
    success : function(data) {
            $.ajax({
                type : "POST",
                url : yourUrl,
                data:  yourData,
                success : function(data) {
                   //do your stuff with the retuned data
                },
                error : function(data){
                    //stuff in case of error
                }
            });
    },
    error : function(data){
        //stuff in case of error
    }
});