掩蔽和放大器;放大器;对于AJAX请求放大器、掩蔽、AJAX

2023-09-10 21:45:55 作者:騙子隨口說說傻子却當ㄋ真

这是一个后续的问题,我问了几个星期了。

This is a follow-up to a question I asked a few weeks back.

以下内容:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test</title>
</head>
<body>
<a onclick="start_ajax_request('url.php&key1=val1&key2=val2&key3=val3')">Test</a>
</body>
</html>

将不可以验证在W3C验证为HTML 4.01过渡,错误,据我所看到的。它抱怨实体,并希望每一个符号转换成&放大器;放大器; &放大器;放大器; 在给定的情况下但是,这是错误的,因为我的Ajax请求需要简单的&符号,将打破反馈时的&放大器;放大器;

will not validate in the W3C validator as HTML 4.01 transitional, wrongly, as far as I can see. It complains about entities and wants each ampersand converted to &amp;. &amp; in the given context however, would be wrong, because my Ajax request needs plain ampersands and will break when fed &amp;.

有没有办法来掩盖/逃离这个例子中的&符号,这样它仍然会通过Ajax请求有效的URL,并关闭了验证?

Is there a way to mask/escape the ampersands in this example so that it's still a valid URL that will pass through the Ajax request, and shuts up the validator?

推荐答案

试着使用JS escape()函数,并通过传递符号为%26同样的方式传递,我相信你看到的空间通过为%20

Try passing with the JS escape() function and by passing the ampersand as %26 The same way I am sure you see spaces passed as %20

希望工程

 
精彩推荐
图片推荐