jQuery ajax() and cakePHP urls
Posted
by Pickledegg
on Stack Overflow
See other posts from Stack Overflow
or by Pickledegg
Published on 2009-06-18T09:39:06Z
Indexed on
2010/06/09
6:52 UTC
Read the original article
Hit count: 202
I'm trying to call the 'tariff' action of my 'countries' controller using jQuery ajax() and pass it a country name in the following format:
/countries/tariff/countryname
however, with the following code ( set to GET ), it is calling this with the get '?' added:
/countries/tariff/?countryname
$(document).ready(function(){
$('#CountriesIndexForm select').change(function(){
$.ajax({
type: "GET",
url: "/countries/tariff/",
data: escape($(this).val()),
success: function(html){
$(this).parent().next('div').html(html);
}
});
});
});
I understand its because the type: is set to GET, but is there a fix for this?
© Stack Overflow or respective owner