How to assign a data from $.get to a var, or read the responseText

How to assign a data from $.get to a var, or read the responseText

Hi, I've been looking everywhere for this...

I've got this dict in JS - 
  1. {
    ranges: {"year 2013": ["01/01/2013", "31/12/2013"]}
    opens: 'left',
    format:
    'dd/MM/yyyy',
    separator:
    ' to ',
    startDate: START_DATE,
    endDate: END_DATE,
    minDate:
    '01/01/2005',
    maxDate:
    '31/12/2023', }
Now I'd like ranges to be dynamic and not hard coded so I managed to pull data using this request:
  1. $.get("accyears", function(data){data})
I obviously can't put the whole thing in a variable as it's an object.
Trying to set 'data' as a global variable won't help as it's not referable outside its scope.
I can only use it inside the scope for console log or alert.
How can I pull 'data' out and assign it to my dict --> 'ranges'
Tried even setting 'ranges: data' inside the scope, but having $.get request inside is not working.

Please help..