Advertisement
Guest User

Untitled

a guest
Jul 14th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  $("#projects").click(function() {
  2.                 jQuery.ajax({type: "POST", dataType: "JSON",
  3.                         url: "<?=base_url()?>index.php/home/projectsSlider",
  4.                         success: function (data) {
  5.                             var projects = data.Projects; //array
  6.                             var screenshots = data.Screenshots; //array
  7.                            
  8.                             //direct, one-off indexed
  9.                             console.log(projects[0].projectId);
  10.                             console.log(data.Projects[0].projectId);
  11.                            
  12.                             //looped with map
  13.                             projects.map(function(project, index) {
  14.                                 console.log(project.projectId);
  15.                             });
  16.  
  17.                             //traditional for
  18.                             for(var i1 = 0; i1 < projects.length; i1++) {
  19.                                 console.log(projects[i1]);
  20.                             }
  21.  
  22.                             //direct, one-off indexed
  23.                             console.log(screenshots[0].screenshotURI);
  24.                             console.log(data.Screenshots[0].screenshotURI);
  25.  
  26.                             //looped
  27.                             screenshots.map(function(screenshot, index) {
  28.                                 console.log(screenshot.screenshotURI);
  29.                             });
  30.  
  31.                             if (data.returned === true) {
  32.                                 $("#content").fadeOut(150, function() {
  33.                                     $(this).replaceWith(projectsSlider(data.Projects[0].projectId, data.Projects[0].projectName, data.Projects[0].startDate, data.Projects[0].finishedDate, data.Projects[0].projectDesc, data.Projects[0].createdFor, data.Projects[0].ontributors, data.Screenshots[0].screenshotURI, data.Projects[0].websiteURL), function() {
  34.                                         $(this).fadeIn(150);
  35.                                     });
  36.                                 });
  37.                             }
  38.                         }
  39.             });
  40.        });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement