• 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

jQuery - ajax call .load()

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
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

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?
 
Dennis Spring
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solution:

jQuery.load() expects the second parameter to be a hash.
(kudos to Brandon Orther)
 
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
So how exactly did you expect us to solve your problem? Had you posted this on another forum as well? If so, please BeForthrightWhenCrossPostingToOtherSites.
 
Sheriff
Posts: 67747
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

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.
 
Dennis Spring
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67747
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

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
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:

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
Sheriff
Posts: 67747
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
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...
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I smile when I write some of my terse responses. Heck, sometimes I downright chuckle out loud.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:...chuckle out loud.


COL?
 
Bear Bibeault
Sheriff
Posts: 67747
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
Or maybe it's the difference between LOL and lol?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic