title: jQuery ajax does not work with window on load
body: <p>I have this <code>jquery</code> code. This code is working well, but when I put this code into window onload, it shows me nothing. Why is this happening? Does ajax not work with window onload?</p>
  <pre><code>$(window).on('load', function() {
      let searchParams = new URLSearchParams(window.location.search);
      let catId = searchParams.get('catId')
      let searchText = searchParams.get('SearchText');
      let catName = searchParams.get('catName');
      let nextPage = Number(searchParams.get('page'));
      let newUrl = 'https://www.aliexpress.com/glosearch/api/product?CatId=' + catId +'&amp;SearchText=' + searchText + '&amp;catName=' + catName + 'SortType=default&amp;page=' + nextPage + '&amp;isrefine=y&amp;';
      console.log(newUrl)
      
      let fortest = $('.product-pagination-wrap').text();
      console.log(fortest);
      
      $.ajax({
          url: newUrl ,
          type: &quot;GET&quot;,
          dataType: 'JSON',
          success: $.getJSON( newUrl, function( data ) {
              console.log(data)
          }),
  
          error: function (xhr, status, error) {
             console.log(xhr.status);
             console.log(error);
             }
         });  
      });
  });
  </code></pre>