通常,当您将不完整的字母数字形式的内容作为URL的一部分传递时,您会希望对其进行URL编码。
在URL编码中,
&被替换为
%26(因为0x26 = 38 =的ASCII码
&)。
为此,您可以使用函数
enpreURIComponent:
$.ajax ({ type: "POST", url: "../../includes/forms/add_gallery.php", data: $("#addGallery form").serialize(), success: function() { $("#addGallery").dialog('close'); window.location.href = 'display_album.php?album=' + enpreURIComponent(title); }});请注意,它
escape具有
+未编码的缺点,并且将在服务器端作为一个空间解码,因此应避免使用它(source)。
如果您希望在PHP级别在服务器端执行此操作,则需要使用函数
urlenpre。



