\" symbol using jQuery ajax with POST method, but I\'m not getting the textbox value with \">\" symbol. I\'m tired of find a solutio" />
开发者

jQuery ajax POST params with ">" symbol problem

I'm try开发者_运维问答ing to get a textbox value which contains ">" symbol using jQuery ajax with POST method, but I'm not getting the textbox value with ">" symbol. I'm tired of find a solution, please could anyone help me to fix this problem.

<div id="subi"><input type="textbox" id="test"><button onClick="sub()">Submit</button></div> 
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
function sub() {
    var result = { content : $('#test').val() };
    alert(result);
    $.ajax({
        url: 'subi.php',
        type: 'POST',
        contentType: "application/x-www-form-urlencoded;charset=UTF-8",
        data: result,
        dataType: 'text',
        success: function(html) {
            $('#subi').html(html);
        }
    });
}
</script>


Actually you should do this server side(you should call htmlenties() on the string you are returning), just to check that this is the problem does this work?

success: function(html) {
    $('#subi').html(escape(html));
}


try escape() function

http://www.w3schools.com/jsref/jsref_escape.asp https://developer.mozilla.org/en/DOM/window.escape

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜