0

i am using ajax to return json data. the script goes like this

  var response;
  $.post("GetResults", { Searchterm: Searchterm }, function (data) {

       response = data;

    });

while debugging i see that response is shown as undefined.

I dont want to use the code like below cause i want response to be used in multiple functions:

  $.post("GetResults", { Searchterm: Searchterm }, function (data) {

      var response = data;

    });
Himaan Singh
  • 725
  • 1
  • 7
  • 17
  • I don't think problem is with `response` being a global variable. It should be what you are returning to your ajax post request. – Mohit Bhardwaj Jul 08 '16 at 07:03
  • Please refer to: http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call closing this Question now. – palaѕн Jul 08 '16 at 07:05

0 Answers0