I'm making an Ajax call to PHP, trying to receive a simple string:
$.ajax({
type: 'POST',
url: $(this).attr('action'),
data: { x: imgX, y: imgY, w: imgW, h: imgH, file: fileName },
cache: false,
success: function(data) {
$('.photo-wrapper').html('<div class="inner"><img src=imgs"' + data + '" /></div>');
console.log('Es crop!!');
},
error: function(data) {
console.log('Es no crop :(');
}
})
In PHP I got:
$digits = '00001';
echo 'img-' . $digits . '.jpg';
If I log or alert the received data in JavaScript, it shows properly. However, the img src url I try to form adds '%22' ot the both ends of string.
I know it's url encoded ", but the problem is that I can't figure out why it shows. Is this problem in the PHP end or is this a problem with my Ajax call?
I've also tried str.replace to it, without any effect. How can I get rid of those in JavaScript?