How to escape & in a POST request in jQuery?
Have you tried this syntax?
data: {"id":id, "value": value, "type": type }
You can set your data
option as an object and let jQuery do the encoding, like this:
$.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.'); }
});
You can encode each value using encodeURIComponent()
, like this:
encodeURIComponent(value)
But the first option much simpler/shorter in most cases :)