views:

30

answers:

1

Hi All,

$('#div1').load(url, { 
    id1=ident1, 
    id2=ident2 
}, function() { 
    // Foo
})

is doing a post instead of what I thought should be a get. Is there a way to make it a get?

Thanks, rod.

+3  A: 

From the documentation "The POST method is used if data is provided as an object; otherwise, GET is assumed."

Use jQuery.param to serialize the data first.

$('#div1').load(url, jQuery.param({ 
    id1:ident1, 
    id2:ident2 
}), function() { 
    // Foo
})

Just noticed your example is syntactically invalid as well. Object literals use ":", not "=", to relate a object key to its value.

Matt