在jQuery的AJAX功能数据变量变量、功能、数据、jQuery

由网友(浅梦)分享简介:我试图用code以下,但它不工作:最新工作:I'm trying to use the code below, but it's not working:UPDATED WORKING: $(document).ready(function() { $('.infor').click(function () {...

我试图用code以下,但它不工作: 最新工作:

I'm trying to use the code below, but it's not working: UPDATED WORKING:

$(document).ready(function() { 
    $('.infor').click(function () {
     var datasend = $(this).html();
        $.ajax({
            type: 'POST',
            url: 'http://domain.com/page.php',
            data: 'im_id='+datasend',
            success: function(data){
                $('#test_holder').html(data);
            }
            });
    }); 
});

正如你可以看到我用$ datasend作为无功派,但它不会返回它的价值,只是它的名字。

As you can see I used $datasend as the var to send but it doesn't return the value of it, only its name.

感谢。

推荐答案

我会改变      $ datasend = $(本)。html的; 至      VAR datasend = $(本)。html的();

I would change $datasend = $(this).html; to var datasend = $(this).html();

接下来我会改变     数据:'im_id = $ datasend', 至     数据:'im_id ='+ datasend,

Next I would change data: 'im_id=$datasend', to data: 'im_id='+datasend,

阅读全文

相关推荐

最新文章