The jQuery -
$.ajax({
type: "GET",
url: "add_showcase.php",
data: "title=" + document.getElementById("title_in").value + "&desc=" + document.getElementById("desc_in").value,
success: function(html)....
When i pass this data as "desc" -
<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/7M-jsjLB20Y?fs=1&hl=en_US"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/7M-jsjLB20Y?fs=1&hl=en_US" type="applicatio开发者_高级运维n/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed>
</object>
add_showcase.php only receives a part of this data -
desc=<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/7M-jsjLB20Y?fs=1
What would you do if you were to rectify this problem?
Replace the &
with the hex value %26
so it looks like http://www.youtube.com/v/7M-jsjLB20Y?fs=1%26hl=en_US
To do this, use Javascript's escape()
function. If you need to, use Javascript's unescape()
function to convert the hex values back to their original values.
Use POST
instead of GET
if you have huge data
use
escape(document.getElementById("desc_in").value)
精彩评论