使用AJAX jquery点击文本后如何获取数据?

I used this code for sending and returning result.

<script type="text/javascript"> 
    $(document).ready(function() {
        $('.special').click(function(){
            var info = $(this).attr("rel");
            //$(this).html(sku);
            $.ajax({
                 type: "POST",
                 url:"../ajax/addSpecialFlag.php", 
                 async: false,
                 data: {info:info},
                success:function(result){
                    $(this).html(result);
                }});       
        }); 
    });    
</script>

<b style="cursor: pointer" class="special"  rel="<?=$v['number']."/*".$v['vid']; ?>">Special</b>

addSpecialFlag.php

<?php
echo $_POST['info'];
?>

This code should return "Info" in "<-b class='special' ->" but no returning result. Where is the problem ? Thanks in advance !

The problem should be that $(this) inside your success-handler is not the same as outside of the handler. Doing it like this should solve your problem:

$(document).ready(function() {
    $('.special').click(function(){
        var $this = $(this);
        var info = $this.attr("rel");
        $.ajax({
             type: "POST",
             url:"../ajax/addSpecialFlag.php", 
             async: false,
             data: {info:info},
             success:function(result){
                $this.html(result);
            }});       
    }); 
});    

<b>? Umad? Please use <strong>.

I have tidied your code so the paranthesis match their line indents and adjusted your success handler. The issue was the success handler is in a different scope to the click function scope so you needed to refer to it in another way, i.e. by assigning it to another variable.

$(document).ready(function () {
    $('.special').click(function () {
        var info = $(this).attr("rel");
        var _this = $(this);
        //$(this).html(sku);
        $.ajax({
            type: "POST",
            url: "../ajax/addSpecialFlag.php",
            async: false,
            data: {
                info: info
            },
            success: function (result) {
                _this.html(result);
            }
        });
    });
});