- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi im building an apk that need Facebook i make it work the example (whit help of the forum :P) and i also make it work on my other apk but i need to fix some error because the framework that im using (ionic). first of all i need to add a button that login to Facebook.
<button class="button widget uib_w_63 d-margins ion button-positive ion-social-facebook icon-only" data-uib="ionic/button" data-ver="0"></button><button id="login_button" onclick="login();">Login with facebook</button> i try adding the id="login_button" onclick="login();">Login with Facebook to the ionic button but it does nothing. the other think is i have document.addEventListener("deviceready", function() from the Facebook plugin that din't work on ionic.
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ionic works different, you need to set up a controller to manage the actions.
Why don't you use the automatic event handlers provided by XDK?
I did this test:
- Drop a button in a ionic xdk project and put b_login in the ID property.
- Select at the designer right panel, INTERACTIVITY section, the new button, and choose Custom script on the Action drop down.
- This creates this section on index_user_scripts.js file
$(document).on("click", "#b_login", function(evt) { /* your code goes here */ login(); });
I added the login(); line above.
My blue button calls the login function :)
Hope this helps,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nicolas,
Is not clear to me. The button is not responding to click and call login() function?
Or it is going to login function and it fails to autenthicate agains FB? If this is the case, will be useful if you post some code.
Regards,
Diego
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sorry about the bad english =/. the "login whit Facebook" button works but i want the blue button of Facebook do the same. i copy id="login_button" onclick="login();" to the blue button but when i click on real device it does nothing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ionic works different, you need to set up a controller to manage the actions.
Why don't you use the automatic event handlers provided by XDK?
I did this test:
- Drop a button in a ionic xdk project and put b_login in the ID property.
- Select at the designer right panel, INTERACTIVITY section, the new button, and choose Custom script on the Action drop down.
- This creates this section on index_user_scripts.js file
$(document).on("click", "#b_login", function(evt) { /* your code goes here */ login(); });
I added the login(); line above.
My blue button calls the login function :)
Hope this helps,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you are great man =). from the same form how can i get the data from those input and send whit JSON by ajax?.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These are two possibilities, you could get them at call moment or inside the login function.
$(document).on("click", "#b_login", function(evt) { /* your code goes here */ login($("#email").val(), $("#password").val()); }); function login(user,pass){ //call the FB login with user and pass values }
Or
$(document).on("click", "#b_login", function(evt) { /* your code goes here */ login(); }); function login(user,pass){ //call the FB login with $("#email").val() and $("#password").val() }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sorry for asking to much but i need to first: get into variable the response.first_name, response.last_name etc and then.
var userProfile = function () {
try{
facebookConnectPlugin.api( "me/?fields=first_name,last_name,picture", ["public_profile"],
function (response) {
// alert(JSON.stringify(response));
$("#profile").html('<h2>'+response.first_name+' '+response.last_name+'</h2><img src="'+response.picture.data.url+'" />');
$("#user_button").hide();
},
function (response) { alert(JSON.stringify(response)) });
}
catch(err) {
message.innerHTML = "Input is " + err;
}
}
send in this structure.
$.ajax({
type: 'post',
url: 'http://192.168.1.100/api/donante/17512241-9',
data: {"nombre":$valor,"telefono":$valor},
dataType: 'json',
success: function (data) {
if(data.result && data.code == 200){
console.log("se inserto");
alert('Data Recibida: ' + data);
}
}
});
the same for the ionic input.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page