window.fbAsyncInit = function() { FB.init({ appId : '792903390816097', xfbml : true, cookie : true, success : true, status : true, oauth : true, version : 'v2.5' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); Parse.initialize("zueQloxSRUCv6GmvwPzLqSKYLV1AOciSt7NxcNoq", "RHzz1kr7IanEw7cLvvM617Ne4bPX7rRFbDP7nL4p"); var url = "file:///Users/shreya/Downloads/sample/parse-js-blank/index.html?bPKn96v1Bp"; //var resulturl =; //$_SERVER['REQUEST_URI'] var resulturl = url.match(/\?(.*)/); console.log(resulturl); var user_id; var Event = Parse.Object.extend("Event"); var User = Parse.Object.extend("User"); var creator = new User(); var user = new Event(); function getInfo(){ var query = new Parse.Query(Event); query.equalTo("objectId", resulturl[1]); query.include("createdBy"); var query2 = new Parse.Query(User); var firstName; var lastName; query.find({ success: function(results) { var output =""; for(var i in results) { var eventDate = results[i].get("eventDate"); user_id = results[i].get("createdBy"); firstName = user_id.get("firstname"); lastName = user_id.get("lastname"); var title = results[i].get("title"); console.log(user_id); var eventType = results[i].get("eventType"); var eventAttributes1 = results[i].get("eventAttributes")[2]; var eventAttributes2 = results[i].get("eventAttributes")[1]; var locationDescription = results[i].get("locationDescription"); var date = eventDate.toDateString(); var time = eventDate.toLocaleTimeString(); console.log(firstName); console.log(lastName); var device = findBootstrapEnvironment(); console.log(device); if (device == 'xs') { output+='
'; output+="
"; } else { output+='
'; output+="
"; } output+='
'; if(eventType == "Running") { output+='
Cinque Terre
'; } else if (eventType == "Tennis") { output+='
Cinque Terre
'; } else if (eventType == "Surf") { output+='
Cinque Terre
'; } else if (eventType == "Cycle") { output+='
Cinque Terre
'; } //output+='
Cinque Terre
'; output+='
'; output+='
'+title+'
'; output+='
'+eventType+'
'; output+='
'+eventAttributes1+'
'; output+='
'+eventAttributes2+'
'; output+="
"; if(lastName == undefined) { lastName=""; } output+='
'; output+='
'+firstName+' '+lastName+'
'; output+='
'+date+'
'; output+='
'+time+'
'; output+="
"; output+='
'+locationDescription+'
'; output+='
'; output+='
'; output+="
"; } console.log(output); $("#list_usernames").html(output); }, error: function() { console.log("Query Error:"+ error.message); } }); } function getname() { "use strict"; $.ajax({ url: "index.php", type: 'GET', dataType: 'JSON', success: function (data) { var json_x = $.parseJSON(data); alert(json_x); alert("success"); }, error: function (response) { alert("WRONG"); } }); } var val = getname(); console.log(val+' is joining You'); getInfo(); function myFunction() { var newquery = new Parse.Query(Parse.Installation); console.log(user_id); newquery.equalTo("user", user_id); Parse.Push.send({ where: newquery, data: { alert: val+"is joining You", category: "FacebookShare", badge: "Increment" }, }, { success: function() { alert("push was successful"); }, error: function(error) { } }); } function next () { location.href = "http://localhost/next.html"; }; function findBootstrapEnvironment() { var envs = ['xs', 'sm', 'md', 'lg']; var $el = $('
'); $el.appendTo($('body')); for (var i = envs.length - 1; i >= 0; i--) { var env = envs[i]; $el.addClass('hidden-'+env); if ($el.is(':hidden')) { $el.remove(); return env; } } }