6

how do I send some data to the server in the .load() function of jquery. I tried this syntax:

$('container').load('path', {key: value});

but for some reason it doesn't work

user765368
  • 19,590
  • 27
  • 96
  • 167
  • 3
    "It doesn't work" is *never* a good error description. Please describe what goes wrong, what error messages you get, etc. Also, there is a [manual](http://api.jquery.com/load/) – Pekka Feb 09 '12 at 21:02
  • 2
    Try posting the code you are using, else its impossible for us to help. – Gunnar Hoffman Feb 09 '12 at 21:02

1 Answers1

29

.load uses POST or GET depending on the parameter passed.

If it's an object, it uses POST:

$('container').load('path', {key: value});

Otherwise, it uses GET:

$('container').load('path', 'key=value');

Without any other info in your question, this is all I could come up with to help.

gen_Eric
  • 223,194
  • 41
  • 299
  • 337