Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#projects").click(function() {
- jQuery.ajax({type: "POST", dataType: "JSON",
- url: "<?=base_url()?>index.php/home/projectsSlider",
- success: function (data) {
- var projects = data.Projects; //array
- var screenshots = data.Screenshots; //array
- //direct, one-off indexed
- console.log(projects[0].projectId);
- console.log(data.Projects[0].projectId);
- //looped with map
- projects.map(function(project, index) {
- console.log(project.projectId);
- });
- //traditional for
- for(var i1 = 0; i1 < projects.length; i1++) {
- console.log(projects[i1]);
- }
- //direct, one-off indexed
- console.log(screenshots[0].screenshotURI);
- console.log(data.Screenshots[0].screenshotURI);
- //looped
- screenshots.map(function(screenshot, index) {
- console.log(screenshot.screenshotURI);
- });
- if (data.returned === true) {
- $("#content").fadeOut(150, function() {
- $(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() {
- $(this).fadeIn(150);
- });
- });
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement