New to jquery; Odd behavior using $.getJSON to access SharePoint 2013 list using REST

New to jquery; Odd behavior using $.getJSON to access SharePoint 2013 list using REST

Got a SharePoint 2013 script editor webpart executing some javascript (and jquery) to pull data from SharePoint lists on the same site. I want data from multiple lists. Accessing the first list works exactly as hoped. When I subsequently try to pull data from a second list, it fails the first time. When I try it a second (or third, or fourth, or ...) time, it works.

Will jquery retain some information from the calls to retrieve the first list, or something? Can't figure out why the code would not work the first time, but will every time after that...

The one difference is that I am 'constructing' the URL for the $.getJSON call for the second list on the fly. The URL for retrieving the first list is static.

First list call:
    $.getJSON(" https://FakeSPserver.com/this/that/_vti_bin/ListData.svc/Tbl_prods2?$orderby=Id asc",function(data) {
...

Second list call:
    var myURL = " https://FakeSPserver.com/this/that/_vti_bin/ListData.svc/Tbl_prodline" + productLine + "?$orderby=Id asc";
   
    $.getJSON(myURL,function(data) {
...

Both of these calls happen in functions called from an 'onchange' event handler function. If I put a breakpoint inside the anonymous inline success function, that break point doesn't get hit the first time a selection is made; it is hit the second time, So, it seems the getJSON call is failing silently, at first.

I realize this question is pretty generic, but I thought I might try anyway...

Thanks!
------------------------------------------------------------------------------------------

This is really an update, and the solution for this issue.

I was sloppy, and overlooked the fact that data returned from the first (async) list access was necessary for the second list access. The first time the code ran, the first list access had not completed before the second list access was started. On the second, third, etc run, the first list access had completed.

Using some Promise and Deferred stuff allowed the calls to complete sequentially, so that the first list access had completed and returned the needed information, before the second list access was initiated. That made the code work as I had expected.

Damn sloppy of me...