Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to change select option list value based on another select option list in jsp

 
Gia Hoa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have jsp page, 2 option lists value , the first option list will decide the value of the 2nd list, value of 2 lists are taken from servlet . How can i do that? With this code result is emty, what do i do wrong? I don't use any libs or framework, just only jsp, java, javasript,jquery and ajax, no JSTL or anything else. This is html:

Ajax:

And java Servlet code:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your alert at line 15 is useless. It reports the content of the variable before the request is complete.

Don't use alerts for debugging. Open the browser debugger and set a breakpoint in your success callback and make sure that the correct data is being returned. You don't seem to be doing anything useful with that data even if it is correct.
 
Gia Hoa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will add this code

after success: function(result) but i don't know what is resutl data so i want to show it first.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting a breakpoint will allow you to view the content of the results variable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic