Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

javascript

var a="sadahdka sarr    &nbsp"

jQuery.ajax(
                        {
                            type:"POST",
                            url:"function/postbai.php",
                            data:"a="+a,
                            success:function(html)
                            {
                                alert(html);
                            }
                        });

Before

var a="sadahdka sarr    &nbsp"

After why

$_POST['a']="sadahdka sarr"

Help jquery ajax html special chars

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
343 views
Welcome To Ask or Share your Answers For Others

1 Answer

because & is a field seperater in the query string. if you want to preserve the & make sure you do encodeURIComponent(a);


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...