• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

How can i pass value to multiple url using ajax?  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i want to send same data to day.jsp page. how can i do that?
 
Author and ninkuma
Marshal
Posts: 66823
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd need to send another Ajax request.

 
robin Morshed
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using three dowpdown menu and each of them changing based on each other. as example if i chose year then month dropdown need to be populated from database and when i chose month then day dropdown need to be populated from database based on year and month selected.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66823
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I see you are using the JSP to format an HTML fragment for insertion. This should most likely be a GET rather than a POST -- is there any processing that takes place on the server besides formatting the fragment?

In any case, you cannot cause a single Ajax request to fork into two separate requests.

If the requests are very similar, you can write a function that makes the request, passing parameters that specify the differences.
 
Bartender
Posts: 19807
93
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AJAX (Asynchronous JAvascript eXecution) is simply an ordinary HTTP request made by JavaScript. Therefore it follows the same rules as a regular HTTP request/response operation. To retrieve data from multiple URLs, you'd need to make multiple AJAX requests, since HTTP can only make a single request to a single URL per request/response cycle.

For a calendar, I suspect you're asking the wrong question. What you really want, I think, is the parts of a date, and the simplest way to do that is usually with a single URL that returns multiple items of data. That can be done in a JavaScript-friendly way by formatting the returned data in in JSON (Javascript Object Notation).

You can write a JSP page that returns JSON instead of HTML. All that's really different is that the Content-Type header for a JSON request should be "application/json" instead of "text/html".
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!