Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ajax without a callback

Does any javascript framework has a function, which:

  • makes AJAX request
  • returns the response

    ( it does not take a callback function as an argument )

I basically want to do the AJAX request the same way I do SQL querys in C, python or whatever.

like image 877
Pawel Furmaniak Avatar asked Dec 30 '22 02:12

Pawel Furmaniak


2 Answers

Yes you can but it is a very bad practice. The javascript engine is single threaded and you risk locking the UI.

like image 124
Sky Sanders Avatar answered Dec 31 '22 14:12

Sky Sanders


No, because if it does not take a callback, then it is not Asynchronous, and subsequently it is no longer AJAX (Asynchronous Javascript And XML). And whereas it is common practice to replace the X with JSON or text, the Asynchronous part is pretty important.

You can make a Synchronous request, but it has its own issues... particularly that sometimes the web page and interface appear to freeze until the request returns.

like image 32
Doug Neiner Avatar answered Dec 31 '22 16:12

Doug Neiner