Magnific Javascript and basic ajax functionality