title: How to use function's return within other function (without using class)
body: <p>I have a function:</p>
  
  <pre><code>def search_result(request):
  
      if request.method =='POST':
          data = request.body
          qd = QueryDict(data)
          place = qd.values()[2]
          indate = qd.values()[3]
          outdate = qd.values()[0]
          url = ('http://terminal2.expedia.com/x/mhotels/search?city=%s&amp;checkInDate=%s&amp;checkOutDate=%s&amp;room1=2&amp;apikey=%s') %(place, indate, outdate, MY_API_KEY)
          req = requests.get(url).text
          json_data = json.loads(req)
  
          results = []
          for hotels in json_data.get('hotelList'):
              results.append(hotels.get('localizedName'))
          return HttpResponse(results)
  </code></pre>
  
  <p>now I want to use func1's return within other function to render template something like this:</p>
  
  <pre><code>def search_page(request):
  
      r = search_result(request)
      d = r.content
      return render(request,'search.html', {'res':d})
  </code></pre>
  
  <p>and this actually do not work.
  Does any way exist to do  what I want (without using class)? 
  I make post via ajax from template form and my first function works properly and prints result in console. The problems occurs when I try use my response in next function to render it in template. Thats why I ask to help me. Have you any ideas to make my response from first function visible for another function? </p>