Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery converts & into & and breaks my code. How can I stop this?
    text
    copied!<p>I am trying to embed a flash movie on a webpage through AJAX using jQuery. The flash movie takes in several commands from the querystring.</p> <p>Thru an AJAX command jQuery returns HTML code that embeds the flash movie, this code has &amp; in the querystring which then get converted to &amp;amp; - this breaks the code and stops the flash movie from being displayed. The dataType is "text", not "html" in the ajax call.</p> <p>Ive search around and seen a few people have suffered with this problem. Apparently the main problem is that using .html() or .append() to insert code into a webpage automatically converts &amp; to &amp;amp; - Id like to be able to insert code without this happening. However Id settle for simply converting them back again (which seems to be the main solution to the problem Ive seen), but this isnt working for me at all.</p> <p>I am running this bit of code to replace all the &amp;amp; with &amp;:</p> <pre><code>$(target+' embed').attr('src',function(){ var currentHref=$(this).attr('src'); var newHref=currentHref.replace(/amp;/ig,''); return newHref; }); </code></pre> <p>Where target is the Id of the container div the flash movie is in. This code doesnt find any &amp;amp; - but when I view the source the &amp;amp; are still present and the flash movie is still not working.</p> <p>Id love to be able to insert code without this &amp; to &amp;amp; conversion happening. Can this be done with jQuery? Failing that, how can I get this bit of code to replace all the &amp;amp; with &amp;?</p> <p>Sorry for the long question and TIA.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload