I am doing something like this
var apiOptions = {
url: url,
dataType: 'jsonp',
type: "GET",
success: success
};
if(dataOptions) {
apiOptions.data = {
key: self.settings.key,
limit: self.limit,
address: dataOptions.address,
};
}
$.ajax(apiOptions);
And it works fine for everything except for when I have " & ", so spaces around an ampersand. So the request parameter looks like "D+&+D,+enterprisess"
or D+%26+D%2C
. This then returns a 404 on the server.
Any idea what to do here ?
For pass parameters with space and speacial character in ajax, you have use escape and unescape function.
var test = 'Exemplae Actão ç @#$%$ ';
var testEscape = escape(test);
console.info(test , testEscape , unescape(testEscape ));
This solve you problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With