i have an input element with & in value:
<input type="checkbox" value="Biografie, ?ivotopisy, osudy, Domácí rock&pop" />
When i try sending it through an ajax request:
$.ajax({
type: "POST",
url: "/admin/kategorie/add/link.json",
data: "id="+id+"&value="+value+"&type="+type,
error: function(){alert('Chyba! Reloadněte prosím stránku.');}
});
the post data that actually gets sent is:
id: 1
pop:
type: e
value: Biografie, ?ivotopisy, osudy, Domácí rock
*Note that all the variables in data are defined and value contains $(thatInputElement).attr('value').
How can I escape the &
properly so that post field value
would contain Biografie, ?ivotopisy, osudy, Domácí rock&pop
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…