Multiple getJSON methods - neither return
Was wondering if anyone has come across this problem (hopefully it is a problem and I haven't just overlooked something..)
I have a javascript file that calls two different getJSON methods and appends the result(s) to the same list. The first getJSON method will work, and the code will jump to the function holding the second getJSON
only if the second getJSON is commented out. When the second getJSON is uncommented, neither getJSON method works - as far as I can tell, it doesn't even fire off the getJSON method.
Since the second getJSON method is commented out in the below code snippet, the first getJSON does work and returns correctly. But as soon it is uncommented, nothing returns at all for either getJSON. Appreciate any ideas or help! I'd also like to note that both php return correctly with no errors. Again, hope I just didn't miss something small...
- $.getJSON(serviceURL + 'getTicketDetails.php?id=' + id, function(json){
-
- var results = json.results;
- if(results == null || results == "" ){
- //alert('There are no Tasks under this Task List');
- $('#ticketDetailsList').append('<li>There is no RFI history</li>');
- $('#ticketDetailsList').listview('refresh');
- }
- var lastDate = "";
-
- $.each(results, function(i,tickets){
- if (tickets.date == lastDate){
- $('#ticketDetailsList').append('<li><a href="ticketDialog.html?id=' + tickets.id + '" data-rel="dialog"><h3>' + tickets.created_by + '</h3><p>' + tickets.reply + '</p><p class="ui-li-aside">' + tickets.time + '</p></a></li>');
- lastDate = tickets.date;
- }else {
- $('#ticketDetailsList').append('<li data-role="list-divider">' + tickets.created_on + '</li><li><a href="ticketDialog.html?id=' + tickets.id + '" data-rel="dialog"><h3>' + tickets.created_by + '</h3><p>'+ tickets.reply + '</p><p class="ui-li-aside">' + tickets.time + '</p></a></li>');
- lastDate = tickets.date;
- }
- }); //<---end .each loop
-
- $('#ticketDetailsList').listview('refresh');
-
- });//<--end post
-
- getParentRFI(id);
- });
- function getParentRFI(id){
- console.info('inside getParentRFI');
-
- /*$.getJSON(serviceURL + 'getParentRFI.php?id=' + id, function(json){
- console.info('inside second getJSON');
- var results = json.parent;
-
- $.each(results, function(i,P){
- $('#ticketDetailsList').append('<li data-role="list-divider">Original RFI</li><li><a href="mainRFI.html?id=' + P.id + '" data-rel="dialog"><h3>' + P.created_by + '</h3><p>'+ P.descrption + '</p><p class="ui-li-aside">' + P.time + '</p></a></li>');
- }
- }); //<---end .each loop
-
- $('#ticketDetailsList').listview('refresh');
-
- });//<--end post*/
- }