• 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

Html Layout for Ajax

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

I have an existing application with Top,Left and Main frame.
as you guessed correctly top frame has top navigation,left has left navigation and Main frame has main content.
In main content i have a module that has 5-6 tabs (sort of small top nav) on click of each tab a struts action is called that returns a jsp that has entire html with head having lot of javascript,css etc and body with same menu (tabs).

I wish to replace the href call to each tab with Ajax call, every thing goes well but there is problem in placing the response which is not html snippets but entire HTML so I believe i need to rearrange the way this module is structured, can some one guide me with the best possible way i should rearrange my html?

-P
 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is each tab a different page or context?

Would a visitor be inclined to hit the back button to get to where they came from?

Would a visitor have any reason to bookmark any of the separate tabs rather than the main page?

If so, I would hesitate before putting your whole app in one page, Ajax or no Ajax.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but there is problem in placing the response which is not html snippets but entire HTML


If you want to insert the Ajax response into an existing page, it cannot be an entire HTML page, but an HTML fragment that is appropriate for use in the location in which your wish to inject it.
 
Praful Thakare
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replies, answering the queries

Is each tab a different page or context?

different jsp page but same context

Would a visitor be inclined to hit the back button to get to where they came from?

No.

Would a visitor have any reason to bookmark any of the separate tabs rather than the main page?

No.

If you want to insert the Ajax response into an existing page, it cannot be an entire HTML page, but an HTML fragment that is appropriate for use in the location in which your wish to inject it

I can trim the HTML but how to I inject the java script that is part of the html head?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The script block should be inline with the HTML fragment.

However, if you are not using a library such as jQuery or Prototype to make your Ajax calls, you'll need to do a lot of fancy footwork to get that script evaluated -- it does not happen automatically.

Are you coding in raw JavaScript or using a library?
 
Praful Thakare
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as i mention its an existing jsp and it uses raw javascript, but for ajax all i am using Jquery.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With jQuery, if a script block is returned as part of a call to load(), the script block will be evaluated. You can check this with a simple diagnostic alert()
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic