Reputation: 41
Trying to change the attr of something, I've got everything working but it adds a blank between the '=' and the 'data' and I really don't know why. I was hoping someone could help me out.
function get_delete_news(news_id) {
$.post('remove_get_news.php', {news_id:news_id}, function(data) {
$('.confirmYes').attr('href', 'remove_news.php?newsID='+data);
});
}
So right now it's written out like this: remove_news.php?newsID= 2
And I want it to be like this: remove_news.php?newsID=2
Upvotes: 2
Views: 78
Reputation: 4927
Apparently remove_get_news.php is concatenating a space to its response. A workaround would be to do a:
data.replace(/(^\s+|\s+$)/g, '');
before using the data variable.
Upvotes: 0