开发者

there is something wrong with this Jquery post?

im trying to pass on the id attribute to the file.php, but its giving me 0 every time, when i try to insert it into the database, the javascript and the html is provided!

$(function() {
      $(".follow").click(function(){
        var element = $(this);
        var I = element.attr("id");
        var info = 'id=' + I;

        $.ajax({
            type: "POST",
            url: "file.php",
            data: info,
            success: function(){}
            });

        $("#follow"+I).hide();
        $("#remove"+I).show();
        return false;

      });
});

html file:

<div id="follow1"><a href="#" class="follow" id=开发者_如何学JAVA"1"><span class="follow_b"> Follow </span></a></div>

p.s. it deos insert the value in the database

file.php:

<?php

$id =$_POST['id'];

msql_insert.........
?>


It may not matter in this case, but the ID of an element is not supposed to start with a number.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜