• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

ajax jquery on the fly servlet response code is bad

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

when I call servlet with load method, he return dinamicly created snipets of html code (whit all nececery div's and his id), and we have got what we wanted to see and we see it, but when we go to view source code those snipet dont exist on that page, and the most worst part - my beautiful jquery effects dont see those divs id too, and nither effects wont work.

So css see them and colors format is good, but jqurey no, wich are define to grab same divs ids.

What shall I do? please help
Thanks
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you add elements to the DOM after the page has rendered, doing a view source, you won't see them. The browser can only show what was initially rendered to the page. So forget about that, because that isn't your problem anyway.

Regarding your jQuery effects, you would have to apply them *after* your $.load() has completed. Or you could use the jQuery.live() feature to apply effects to newly added DOM elements. My guess is, you are applying these effects at the wrong time.
 
Sheriff
Posts: 67619
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

Marko Debac wrote:but when we go to view source code those snipet dont exist on that page

Of course not. "View source" does just that, views the source HTML that was sent to the browser. That's all it does.

If you want to see the dynamic DOM tree, use a tool like Firebug.

and the most worst part - my beautiful jquery effects dont see those divs id too, and nither effects wont work.

If you are setting up those effects before the DOM elements exist, then yeah. You need to wait until after the elements exist to try to work with them.

The callback from the load() method will be invoked after the new elements have been added to the DOM, and that's the right place to start working with them.

The exception is events, which can be pro-actively established using live().

You might also be interested in the the LiveQuery plugin, which will automatically trigger handlers when an element matching a specific selector comes into (or out of) being.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BONG!!!
 
Bear Bibeault
Sheriff
Posts: 67619
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

Gregg Bolinger wrote:Or you could use the jQuery.live() feature to apply effects to newly added DOM elements.

Slight correction -- live() can only be used for events, not effects.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Gregg Bolinger wrote:Or you could use the jQuery.live() feature to apply effects to newly added DOM elements.

Slight correction -- live() can only be used for events, not effects.



Which is why I use the LiveQuery plugin. Thanks for the correction.
 
Bear Bibeault
Sheriff
Posts: 67619
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
LiveQuery rocks!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:LiveQuery rocks!



It does! And every time I use it I can't help but feel like I'm cheating or something is going to come back to haunt me later. But it just keeps working and chugging along.
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys, you helped me

..and you put little mascito in my ear for jquery live investigation

Thanks
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic