aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery load with Callback Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery load with Callback" Watch "jQuery load with Callback" New topic
Author

jQuery load with Callback

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1432
I am used to using jQuery.getJSON and get parameter values back from my servlet response.

However, I can get the jQuery.load callback function to fire but cannot figure out how to get parameter values from called servlet.

Wrong queue. Can someone move to HHML Javascript queue?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

What do you mean by "parameter values"?

Parameters are passed to the servlet, not from the servlet.

Or do you mean the response body?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1432
Bear Bibeault wrote:What do you mean by "parameter values"?

Parameters are passed to the servlet, not from the servlet.

Or do you mean the response body?


Yes I am talking about response body return values.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1432


I use the jQuery.getJSON everyday with callback and have not problem at all get return values back.

My problem is the jQuery.load call with call back. The same methods I use for the get response does not seem to work for the post response.

The code I use in my get response method for getJSON is like:



How can use this in the post response?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

Why would you use load() for JSON data? The .load() method is intended to fetch HTML fragments to load into the DOM.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1432
Bear Bibeault wrote:Why would you use load() for JSON data? The .load() method is intended to fetch HTML fragments to load into the DOM.


I am trying real hard to take your suggestions and incorporate them into my web app. So I am replacing my frames with DIV's. When my page is initially called it does a .load for one of two DIV's. It makes a post method request with a callback.

The call back on the JSP is function getResults(wResults){}

In the post response method I (where I need help) need to send back some resultant values.

Back on my JSP I do a .load for a second DIV using values for the parameters I am sending with a request to another servlet.

Is this all wrong?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

Steve Dyke wrote:So I am replacing my frames with DIV's. When my page is initially called it does a .load for one of two DIV's. It makes a post method request with a callback.

What's the purpose of the callback? The response for the load should be the HTML fragment o be loaded into the <div>. Is there something else you need to do?

In the post response method I (where I need help) need to send back some resultant values.

Here's where I'm lost. Why?

Back on my JSP I do a .load for a second DIV using values for the parameters I am sending with a request to another servlet.


???

Are you basing what gets loaded in the 2nd div based upon something in the first? If so, that's kinda weird. Why?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1432
I am re-thinking my plan on this.

Thanks for the help.

Got another issue, another post.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jQuery load with Callback