Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jQuery load with Callback

 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "parameter values"?

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

Or do you mean the response body?
 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am re-thinking my plan on this.

Thanks for the help.

Got another issue, another post.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic