I m trying to send a url string using ajax post but dont not know why the string is auto encoding (%25) or omitting
url = http://www.domain.com.br/berco-elegance-wave-verde-ayoba%2521-6343.html
php receive:
http://www.domain.com.br/berco-elegance-wave-verde-ayoba%21-6343.html
I check with Firebug the post data and the url string is already changed:
POST DATA
url: http://www.domain.com.br/berco-elegance-wave-verde-ayoba%21-6343.html
My jquery code:
function save_competitor() {
$.ajax({
type: "post",
url: "<?php echo base_url();?>admin/storeproduct/insert_competitor",
data: "url="+$("#url"),
dataType:"json",
contentType : "application/x-www-form-urlencoded; charset=UTF-8",
success: function (data) {
if(data.success){
alert('ok');
}else{
alert('error');
}
},
error: function (request, status, error) {
if(status=='parsererror')
window.location.href = 'auth/login/';
}
});
}
HTML:
<input type="text" id="url" name="url" value="http://www.domain.com.br/berco-elegance-wave-verde-ayoba%2521-6343.html"/>
URL Endoding References:
encodeURIComponent and decodeURIComponent will resolve this issue