0

I have a question concerning ajax once again, and I have looked through some questions on here this one in particular(how to pass back an object from an ajax success handler to the calling function?), how do you grab data via ajax to populate an object? Last time I was asking specifically about the Facebook API, but that got me to think there has go to be a better way of doing it.

I thought you could perhaps create a listener to tell you when a certain ajax/api call has finished so you can then go back to the synchronous code and populate your object with that data. Any thoughts?

I really don't like being constricted to running my code within that async call as it ruins all of my nicely organized OOP code.

Any input is appreciated :)

Community
  • 1
  • 1
user3832583
  • 371
  • 4
  • 19
  • If you make an async AJAX call, the response won't be processed while synchronous code is running. The only way to process the AJAX response in synchronous code is with a synchronous XMLHttpRequest. – Barmar Oct 31 '14 at 18:18
  • 1
    This is considered the canonical question regarding returning from AJAX: http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call – Barmar Oct 31 '14 at 18:20
  • Thanks ill check out he other question. – user3832583 Oct 31 '14 at 18:35

0 Answers0