javascript - jQuery's attr() escaping ampersands -


so i'm trying set image src attribute dynamically via javascript so:

var url = 'query.php?m=traffic&q=getgraph&id='+pipeid+'&start=-3h'; console.log(url); $('#3h').attr('src',url); 

the problem is, shows query.php?m=traffic&q=getgraph&id=1&start=-3h in console, the actual set src #3h image element query.php?m=traffic&q=getgraph&id=1&start=-3h

and then, of course, doesn't work. how avoid jquery's attr() methods' character escaping? other suggestions on how should achieve goal welcome well.

if doesn't work, it's not due ampersands being escaped. attribute in html element, xml entities need escaped:

--+------- < | &lt; > | &gt; " | &quot; & | &amp; 

as example, if had index.php?foo=bar&buzz=baz, , wanted have a element target page, need set anchor so:

<a href="index.php?foo=bar&amp;buzz=baz 

the href decoded as: index.php?foo=bar&buzz=baz

i'll see if can't find relevant documentation you.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -