Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Javascript/Ajax

Featured Replies

Quick question.

 

With this: http://michaelgunner.co.uk/insta/

 

I'm using Ajax to make an API request. The thing is, because it's Ajax, the resulting code shows up in the DOM but not in the source, of course.

 

But what this seems to mean is no other Javascript/jQuery works with it. For example (purely for testing):

 

		$(document).ready(function () {

			$(".sort").hover(function(){
					$(".instagram-placeholder").css("opacity","0");
			});

		});

 

Nothing happens to "instagram-placeholder". I assumed using document ready would work, but it appears not.

 

Any ideas? I can't imagine that you just can't do this?

 

Edit: A little research seems to hint at firing the event after the Ajax has loaded. This seems to work:

 

		$(function() {
		$.ajax({
			type: "GET",
			dataType: "jsonp",
			cache: false,
			url: "https://api.instagram.com/v1/users/*************604",
			success: function(data) {

				for (var i = 0; i < 6; i++) {
			$(".instagram").append("<li data-tags='"+ data.data[i].filter +"' class='instagram-placeholder'><a href='#" + data.data[i].id +"'><img class='instagram-image " + data.data[i].filter +"' src='" + data.data[i].images.thumbnail.url +"' /></a></li><div class='overlay' id='" + data.data[i].id +"'><img class='instagram-image' src='" + data.data[i].images.standard_resolution.url +"' /><a href='#page' class='close'>close</a><div class='controls'><h2>" + data.data[i].caption.text +"</h2></div></div>");   				
			$("#filter").append("<li class='sort'><a id='"+ data.data[i].filter +"' href='#"+ data.data[i].filter +"'>"+ data.data[i].filter +"</a></li>");   				

				}	
			$(".sort").hover(function(){
					$(".instagram-placeholder").append("<p>h</p>");
			});					
			}

		});

	});

 

 

Correctimundo?

Edited by brightonmike

  • Author

Ok - that sort of works, but I can only manipulate non-Ajax IDs/Classes. IF I try to manipulate one loaded by the Ajax, no fun.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.