开发者

jquery effects are NOT working

I have some experience in PHP but not in JQuery that much.

My admin.php page has a div which has id named "table1" where co开发者_如何转开发ntent gets loaded via ajax:

document.getElementById("table1").innerHTML=xmlhttp.responseText;

xmlhttp gets data from sorgula1.php page which has some JQuery effects like highlighting table rows. When I'm trying to run the sorgula1.php alone, the highlighting works but when it is loaded via ajax to admin.php, highlighting and other JQuery effects are not working. I've tried everything to make it work but, I always failed. For those of you who will ask me to remove the $(document).ready(function() statement, I'm informing you that it doesn't work.

Here is the sorgula.php code: sorgula1.php

please be specific about the answers guys.Thanx for all answers.


Maybe when you use innerHTML property, the javascript doesn't work. I think you can solve this problem by using jQuery load() function.


The problem is most likely that the elements loaded via ajax do not have the effects applied to them - have you tried calling the $("#myTable").tablesorter(); javascript (again) after the ajax response has been received and injected into the DOM?

Edit sorry it should probably be this code that you call:

$("tr").not(':first').hover(
  function () {
    $(this).css("background","yellow");
  },
  function () {
    $(this).css("background","");
  }
);

or use .live()


Try to rewrite your events to Live(). I would say that it doesn't work, because elements are loaded after the jQuery functions are registered. So try

$("tr").not(':first').live('hover',function(){ // CODE });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜