How do I format the url: for a jQuery ajax() request in CakePHP so it won't add a question mark to the url?
ajax, cakephp, jquery
Solution
make url manually
url: "/countries/tariff/"+escape($(this).val())
Problem
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 ``` Here's the code: ``` $(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?