Reputation: 3755
Why isn't my method posting data? According to jquery docs: "Request Method
The POST method is used if data is provided as an object; otherwise, GET is assumed."
var car = {{ car }}
var motorcycle = {{ motorcycle }}
$('.send_data').on('click', function(e){
e.preventDefault();
$('#'+container).load(
$(this).attr('href'),
{ car: car, motorcycle: motorcycle },
function(data) {
$('#'+container).effect('highlight');
}
);
})
Upvotes: 3
Views: 2921
Reputation: 134167
The jQuery .load
source code is straightforward:
} else if ( params && typeof params === "object" ) {
type = "POST";
}
Unless car
or motorcycle
are not being classified as objects, a POST
request should have been issued.
Upvotes: 2