File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should I use AJAX for displaying Menu click results?

 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a menu which buttons. On click of one item a form opens and on entering keyword results get displayed. On clicking other page another form displays at the same page instead of first and on enterying data results are displayed. I used strategy of keeping these forms in different Divs and then using javascript for showing or hiding a particular Div.
The above is working fine.
But when the results of either of forms are to be displayed on the same page.Then controling hiding and showing of Divs becomes very tedious.Does this functionality I am trying is simple one which can be showing using simply javascript or it required involvement of AJAX?

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't need to fetch new data from the server, you don;t need Ajax.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes new data from the server is required. This JSP page has 2 different forms(Of which only 1 will be visible at a time: i did this using javascript).On either form submission results would be fetched from server and displayed on same page. The problem I am facing is that location of the menu gets disturbed once the results are displayed for either form.Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's just a matter of making sure that the HTML structure and CSS for the menu aren't disturbed. Not much to do with Ajax per se.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually to get rid of that I had to show results of the next page instead of same page but would require to find a solution.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is my below understanding correct?

Since I need to fetch data from server (My menu item leads to a search where based on keyword it fetches form Database), so it is always better in this case to use AJAX and not refresh whole page.(Why to reload whole page for the search?)

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will very rarely reload an entire page if only part of it needs to be updated.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if only part of it needs to be updated.


Thanks. Suppose there is a Search for keyword where search results would be fetched from the Database? I am new AJAX my understanding is that in this case Search Results should be fetched by an AJAX action. I would go by this approach. Please correct me if I am wrong.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would likely be my approach.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic