Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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?
 
Marshal
Posts: 67226
170
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
Marshal
Posts: 67226
170
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: 20360
112
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".
 
I am displeased. You are no longer allowed to read this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!