send data with jquery.load()

user765368 picture user765368 · Feb 9, 2012 · Viewed 11k times · Source

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

Answer

Rocket Hazmat picture Rocket Hazmat · Feb 9, 2012

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