views:

44

answers:

3

Hay i have a link like this

index.php?sometext=f,fsdsd,rerw,e,wewewe

and when i use .attr("href") on the link, it stops at the first comma, so it only displays

index.php?sometext=f

Any idea how to get ALL the href value

+1  A: 

You should replace , with %2C in your links. This is URL encoding.

Ivan Nevostruev
I used this solution.
dotty
A: 

Commas are among the characters that should be urlencoded when present in a URL, that is, in their case, replaced with %2C.

Alex Martelli
A: 
$('a').each(function(i, el){

    var href = $(this).attr('href');

    if (href.split('?').length == 2) {
        var dir = href.split('?')[0], query = href.split('?')[1];
        $(this).attr('href', dir + '?' + encodeURI(query));
    }

});

encodeURI

andres descalzo