• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

synchronous request through Ajax

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When anyone would make a synchronous request though Ajax???

request.open("GET", "some.do", false);

Thanks.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When they want a sychronous Request!

Eric
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
When they want a sychronous Request!

Eric



 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rathi ji:
sychronous Request



synchronous request,

"the code will hang until a response comes back"
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Saif Uddin:


synchronous request,

"the code will hang until a response comes back"



Not the code, the browser will hang...
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you are right.

can you run javaScript code without using browser? absolutely not

hope you understand what the exactly I mean when I use "code" word.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, my question was different and still unanswered. :roll:
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well, my question was different and still unanswered



Eric has already answered it for you. Hasn't he?

When they want a sychronous Request!

 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jaikiran Pai:
[QB][/QB]



Nope. I was expecting 2-3 practical situations where it's good to make synchronous request through Ajax.
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would contend there aren't many instances where you'd want to set XMLHttpRequest to synchronous mode... although Eric is of course correct, if your employer says so, do it

Failing that though, I think what people *do* more often come up against is not wanting more than one AJAX request processing at a time, which is synchronous in a sense too, but not the same way. In this situation you see things like setting and checking flags before sending a new request, locking out the submit button on the UI, things like that. That tends to come up more often.
 
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I say it doesn't make sense to use AJAX in synchronous mode?



The whole purpose of Ajax is Async then under which scenario we should set this false parameter?
 
Frank Zammetti
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rajan... I think the cases where it might be desirable to make a synchronous call are when you absolutely have to ensure other code doesn't execute before the response is returned... maybe you have some timer code that can't fire until the response is received. Might make sense then. It's also an easy way, although I'd contend a poor way, to guard against multiple simultaneous AJAX requests, which is sometimes desirable.

I agree though, I can't myself think of a case where it really does make more sense than other options, but just because I can't come up with a scenario doesn't mean there aren't any
 
It's just a flesh wound! Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic