Count divs inside div loaded from external php file

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 1630 Views - Last Post: 11 February 2013 - 06:12 PM

#16 amatzprogrammer  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 75
  • Joined: 07-July 11

Re: Count divs inside div loaded from external php file

Posted 11 February 2013 - 12:40 PM

...

:| i dnt know how, sorry.
Was This Post Helpful? 0
  • +
  • -

#17 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3525
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Count divs inside div loaded from external php file

Posted 11 February 2013 - 12:50 PM

check out the second example: http://api.jquery.com/load/
Was This Post Helpful? 0
  • +
  • -

#18 amatzprogrammer  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 75
  • Joined: 07-July 11

Re: Count divs inside div loaded from external php file

Posted 11 February 2013 - 05:33 PM

I tried something like this 4hours ago..


<script type='text/javascript'>
	$("#divs").load("displayFiles.php", function(){
	 alert($("#divs div").size());
	});  
</script>

include 'displayFiles.php';


However, it seems that, it's not entering the load function.
And the contents of the file is not loaded in the div.
Was This Post Helpful? 0
  • +
  • -

#19 amatzprogrammer  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 75
  • Joined: 07-July 11

Re: Count divs inside div loaded from external php file

Posted 11 February 2013 - 06:12 PM

It works now!! :)

	
//doing AJAX request
$(document).ready(function(){
	$.ajax({
	  url:"displayFiles.php",
	  success:function(data){
          // do something with the return data if you have
	  $("#divs").html(data);
	  var totalrecords= $("#divs div").size();
	  //function processing totalrecords
	  }
	});    
});

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2