I\'m trying to use JQuery although i\'m struggling to successfully wait for a ajax call to succeed before executing further code. Is there a way to wait for an ajax to call
Have a look at jQuery deferreds. You can't halt this, but you can call other code after an AJAX call returns.
// No way to stop.
$.ajax(...);
doSomething();
But with deferds you can:
$.ajax(...).success(function() {
doSomething();
});
See this article.
http://www.erichynds.com/jquery/using-deferreds-in-jquery/