permaculture playing cards*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery - ajax call  .load() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery - ajax call  .load()" Watch "jQuery - ajax call  .load()" New topic
Author

jQuery - ajax call .load()

Dennis Spring
Greenhorn

Joined: Apr 07, 2010
Posts: 12
I am having difficulty getting the .load() method to work with a POST variable parameter.
I searched the founders' site, jQuery.com, but there is an issue on their web-page dealing with the .load()
method for ajax calls. The issue prevents the page from fully loading. In other words, I cannot get
access to the information I need.

In my previous post to this javaRanch site,
"jQuery In Action Chapter 8 - use a php data file for ajax call" on April 14,
I detailed the GET method which works just fine, and the POST which does not.

I suspect the GET method is less secure, and besides, the spec for the project I'm doing
defines that POST vars are to be used.

Can anyone help me out?

regards,
Dennis
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I suspect the GET method is less secure


Security has nothing to do with it. Some folks think that POSTing is more secure because you don't see the query parameters in the URL. This is silly because there is always a way to see query params if you want to. The difference in POST and GET, at its core, is that POST should be used for pushing data to the server in order to save/update information. With GET you are simply requesting data from the server. That's the simple explanation.

With regards to your problem, you haven't told us any details about what is happening versus what you are expecting to happen. When you say "In other words, I cannot get access to the information I need." what do you mean? Are you getting errors? Have you used a tool like Firebug to determine if the POST is going in correctly and if you are getting a response? What is happening on the server?


GenRocket - Experts at Building Test Data
Dennis Spring
Greenhorn

Joined: Apr 07, 2010
Posts: 12
Solution:

jQuery.load() expects the second parameter to be a hash.
(kudos to Brandon Orther)
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

So how exactly did you expect us to solve your problem? Had you posted this on another forum as well? If so, please BeForthrightWhenCrossPostingToOtherSites.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Dennis Spring wrote:jQuery.load() expects the second parameter to be a hash.

Not just.

The data parameter to .load() can be an object hash, a properly formatted query string, or the array format returned by $.serializeArray().

Which format you use determines whether .load() will use a GET or a POST.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dennis Spring
Greenhorn

Joined: Apr 07, 2010
Posts: 12
Ouch. I have rarely been accused of not being forthright...
I did not post the question to another site.
One of the 'young guns' at our company helped me with it on his break.
I have shared that info with the folks visiting your site.

I did originally post the question to the 'Web' forum on your site.
However, someone moved it from that forum to something called the backporch forum, or something...
I re-posted it on this HTML forum, after I found it, hoping to get a response.
Apparently it was moved a second time to this forum, after I posted it here.

Seems like a lot of anger for a friendly place...
I did, after all, provide code for a php alternative('getDetails.php') for chapter 8 of Mr. Bibeault's book 'jquery in Action'.



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Dennis Spring wrote:Ouch. I have rarely been accused of not being forthright...

No need to feel slighted. All you posted is that you got help from someone who is not a member of this site. That's usually a sign of cross-posting. No harm done.

I have shared that info with the folks visiting your site.

And we thank you for that. We like it when people do that.

I did originally post the question to the 'Web' forum on your site.

There is no "Web" forum, so I'm not sure where you mean. The Bunkhouse Porch discusses books, so since your question mentioned my book...

Future jQuery question should be posted here and there should be no confusion.

Seems like a lot of anger for a friendly place...

You are seeing anger where none is intended. Gregg was merely pointing out that if you do post elsewhere on the net that it's friendly to let people know about that so that they don't waste time posting what may have already been posted elsewhere.

I'm not sure why you think that anyone is angry.

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Bear Bibeault wrote:
Seems like a lot of anger for a friendly place...

You are seeing anger where none is intended. Gregg was merely pointing out that if you do post elsewhere on the net that it's friendly to let people know about that so that they don't waste time posting what may have already been posted elsewhere.

I'm not sure why you think that anyone is angry.



Maybe because I said "So how exactly did you expect us to solve your problem?". Re-reading I can see how that might have come across. But Bear is correct, no anger intended.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Written communication can be that way. My posts are frequently terse (because that's all I usually have time for) and can sometimes be taken the wrong way. I try to encourage people to imagine the poster smiling as they type and see if that changes the perception...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I smile when I write some of my terse responses. Heck, sometimes I downright chuckle out loud.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

David Newton wrote:...chuckle out loud.

COL?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Or maybe it's the difference between LOL and lol?
 
wood burning stoves
 
subject: jQuery - ajax call .load()
 
Similar Threads
jQuery - ajax call .load()
relative vs absolute jsp url issue
AJAX Dynamic Population
AJAX or AJAX Framework
Formatting problem