English 中文(简体)
为什么这种“微不足道”不起作用?
原标题:Why does this "next" not work?

我想通过Ajax获取数据,将其填入四点。

传真:

<div class="review">
  <span class="seefull" rel="1">see full content</span>
  <div class="content"></div>
  <div class="c_createtime">(06-15 04:03:13)</div>
</div>

<div class="seg_r"><img src="http://img.dachaocai.com/sys/seg_2.gif"/></div>

<div class="review">
  <span class="seefull" rel="2">see full content</span>
  <div class="content">12</div>
  <div class="c_createtime">(07-31 12:46:18)</div>
</div>

j 质量:

$(function() {
  $(".seefull").click(function() {
    $.ajax({
      url: "/j/fullreview",
      data: {"t":"b","id":$(this).attr("rel")},
      success: function(data) {
        $(this).find("div .content").html(data);
      }
    })
  })
})
最佳回答
  $(function(){
        $(".seefull").click( function (){
            var $this = $(this);
            $.ajax({
                url:"/j/fullreview",
                data:{"t":"b","id":$this.attr("rel")},
                success:function(data){
                    $this.parent().find(".content").html(data);
                }
            });
        });
  });

它涉及“这种情况”。

当退税职能执行时,这不再提及你原来的物体。 因此,你需要将其原始参考资料储存在一个变量上,并使用该变量,以确保你总是提及正确的要素。

var $this = $(this);

根据上述代码,您的物体现在存放在这一变量上。

$this.parent().find(".content").html(data);

Find the parent of our element, then find the element with class "content", and change its content.

我没有发现一整类内容,因为根据你的法典,只有一类内容。

问题回答

究竟是什么工作?

在第一次模糊时,我认为......

$(this).find("div .content").html(data);

......

$(this).parent().find("div.content").html(data);

如果data/code> 是个名词,那么你将看到的产出将像<条码>[目标]目标/代码”而不是任何有用的数据,那么就必须对名人物体进行额外分类。

change

$(this).find("div .content").html(data);

纽约总部

$(this).parent().find("div.content").html(data);

problem 1:
$(this) refers 纽约总部 the span that was clicked, wich doesn t contain a div. use parent() 纽约总部 go ane level up in the dom-tree and search for div.content there.

problem 2:
div .content means "any element wich class content inside of a div".
this should be div.content wich means "a div with class content")

它概括了背景......

 $(function(){
        $(".seefull").click(function(){
           vat that = $(this);
            $.ajax({
                url:"/j/fullreview",
                data:{"t":"b","id":$(this).attr("rel")},
                success:function(data){
                    that.next().html(data);
                }
            })
            })
        })




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签